Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exporting Firestore collection data, edit and re-upload

I created a Google Cloud account and have everything setup but for some reason I can't figure out how to export my Firestore data to a "file" edit/add to that file and re-upload.

I'm read through this several times: https://firebase.google.com/docs/firestore/manage-data/export-import#import_specific_collections

No code but just real confusion. I am not sure how to export a collection so that I can make bulk edits.

like image 978
hefty_kat Avatar asked Jan 30 '26 23:01

hefty_kat


1 Answers

You can use gcloud cli to export to a cloud store bucket

gcloud beta firestore export gs://[BUCKET_NAME]

To export to a local file, you can use the REST API

POST https://firestore.googleapis.com/v1beta1/{name=projects/*/databases/*}:exportDocuments

There is also an npm app which can do this, node-firestore-import-export.

firestore-export --accountCredentials path/to/credentials/file.json --backupFile /backups/myDatabase.json
firestore-import --accountCredentials path/to/credentials/file.json --backupFile /backups/myDatabase.json
like image 111
johndoe Avatar answered Feb 01 '26 15:02

johndoe