I am running the following command to export my Firestore collection.
gcloud alpha firestore export gs://[...] --collection-ids='[...]'
The resulting export only contains documents at root level, but not any sub-collection under any documents.
How can I export all sub-collections from my collection?
I am following this doc from google.
To back up also sub-collections, I have to specify the collection ids of sub-collections.
gcloud alpha firestore export gs://[...] --collection-ids='[COLLECTION_ID]','[SUB_COLLECTION_ID_1]','[SUB_COLLECTION_ID_2]'
Without --collection-ids
option, it can also back up the whole firestore including all sub-collections. But specific collection cannot be imported from this backup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With