I've started building my app with React for the UI and Firebase as the backend service. I'm using Firestore for my database.
I've reached the point where I began uploading data to it (manually, through the UI I've build for this operation - Add/Edit/Delete form).
By now, I have a few collections with all my data stored into Firestore.
Sometimes I need to make some bulk editing scripts using the firebase-admin SDK. For example: imagine that I've decided that I need to change some images src
to a different domain. I can't do it manually.
But now I'm handling my whole data at once, and if I make a mistake, the disaster potential is great.
So I searched for a way to export my data as a backup and found this piece of doc:
https://firebase.google.com/docs/firestore/manage-data/export-import
I've followed the tutorial and managed to export all my data at once to my storage bucket using gcloud
SDK, by doing:
gcloud beta firestore export gs://[BUCKET_NAME]
And now I have this folder in my bucket, which a bunch of files and metadata that I can't really inspect/explore.
QUESTION 1:
Is it possible to inspect/explore the collections and documents that are inside the exported files?
And as far as importing goes, the docs says I can do:
// TO IMPORT EVERYTHING
gcloud beta firestore import gs://[BUCKET_NAME]/[EXPORT_PREFIX]/
// TO IMPORT SPECIFIC COLLECTIONS
gcloud beta firestore import gs://[BUCKET_NAME]/[EXPORT_PREFIX]/ --collection-ids=[COLLECTION_ID_1],[COLLECTION_ID_2]
QUESTION 2:
How does the importing process work? Will it replace the existing collections that currently exist inside my Firestore? Do I need to clear/empty my Firestore before importing or does it overwrite the whole thing?
I thinking that if I have collection1
and collection2
and I import only collection1
, I'm assuming the collection2
will remain intact, am I right?