Cloud Firestore has amazing realtime and scaling capabilities, but the Firebase Console is missing some essential features like renaming a document (change the document ID). Previously you had to create a new document with the same data and delete the old document manually or write a script that does this for you. When the document contained subcollections, they needed to be transferred to the new document as well.
Luckily now there’s Firefoo, the Firestore GUI client that lets you rename documents with the click of a button!
Step by Step Instructions
- Download and install Firefoo.
- If prompted, sign in with Google. This happens automatically if you are already logged in with the Firebase CLI tools.
- Click the collection in the sidebar on the left.
- Find the document in the output table. If the document is not visible right away, you can click load more until it is visible. If your collection has too many documents, instead use the Where, Order by or Limit fields and click Run to find it. Another alternative is to enter the document path directly in the Path field, e.g.
myCollection/myDocumentIdand click the Run button.
- Right-click on the left-most field (ID column) of the document and choose Rename Document.
6. Change the last part of the Target Path to the new document name.
7. That’s it! Confirm with OK.
If your document contains subcollections, Firefoo will automatically copy them over to the new location, which might take some time. You can track the progress in the Tasks popup, reachable through File › Tasks.
Firefoo is the sophisticated GUI admin tool for Firebase Cloud Firestore. It helps you organize your data by working around the limitations of the Firebase Console. Features include…
- Table View
- Export/Import JSON and CSV
- Geo-Point Map
You can also rename, duplicate and delete documents, collections and fields, edit them as JSON and copy data to the clipboard. Undo changes, query with multiple where and order-by clauses and work with your local emulator!
How many requests will this use from my quota?
Renaming a document will use at least 4 requests: two reads, one write and one delete. The two reads are due to the additional request to check whether the document has subcollections or not.
If there are subcollections, these same 4 requests are repeated for every document in the subcollections.