How to Rename Collections in Firebase Firestore

Google’s Cloud Firestore is an amazing database for its realtime and effortless scaling capabilities, but it’s missing the essential feature to rename a collection (change the collection ID). The official Firebase Console does not support renaming collections, so previously you had to write a script for that. That script needed to read all documents from the old collection, write them into the new collection and finally delete the old documents — while keeping subcollections and rate limits in mind.

Luckily now there’s Firefoo, a Firestore GUI client that saves you the trouble!

Step by Step Instructions

  1. Download and install Firefoo.

4. Enter the target collection name and click OK.

5. That’s it!

Firefoo will automatically copy over all documents. If your collection is big, this might take some time. You can track the progress in the Tasks popup, reachable through FileTasks.

About Firefoo

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

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!

FAQ

What about subcollections?

Subcollections in the documents of the source collection will be copied recursively to the target collection. You don’t have to worry about them.

If you want to rename a subcollection, that is also possible with Firefoo! Subcollections are not shown in the sidebar. That’s why you have to locate the subcollection in the Tree View (not the Table View, which currently does not support subcollections) and open the right-click context menu from there.

How many requests will this take away from my quota?

For every document in your Firestore collection, the rename operation in Firefoo uses two reads, one write and one delete.

The two reads are due to the need to check every document for subcollections, which has to be performed as a separate request.

VP of Engineering at Bliq: Transforming Gig-work in mobility | Creator of Firefoo: The powerful GUI client for Firebase Firestore