Updating a collection name in Cloud Firestore

Sri picture Sri · Sep 10, 2018 · Viewed 9.4k times · Source

Can we change the name of a collection in Cloud Firestore? I have created a collection with 200 documents. Now I want to change the name of the collection. In the Firebase console, I could not find a way to do this.

Is it possible to change a collection's name either through code or in the console. Or Is it possible to export documents from Firestore, create a new collection and then import those documents again?

Please help.

Answer

Doug Stevenson picture Doug Stevenson · Sep 10, 2018

It's not possible to change the names or IDs or collections or documents once they exist. All that data is immutable, for the purpose of building efficient indexes.

You could certainly read everything out, then put it all back in with new names and IDs.