Note : For this We need a nodejs install in our system.
Step 1 : Download Private Key From Firebase Console.
Open Project and Go to the Below Path
Project Settings -> Service Account -> Generate New Private Key
Save this file in one Folder and Rename it with your Application name.
Step 2 : Run Below Comment to Export the Database.
npx -p node-firestore-import-export firestore-export -a export.json -b backup.json
Now,
export.json is the file name which we have download in the Step 1.
backup.json is the file which will create and database will saved.
Hit Enter Button.
Your Can find the database in the same folder - named as backup.json
Step 3 : Run Below Comment to Import the Database.
npx -p node-firestore-import-export firestore-import -a import.json -b backup.json
Now,
import.json is the file name which we have download in the Step 1.
backup.json is the file which we want to install to the firestore.
Hope you understand this. Thank you Stay tuned.
3 Comments
Thank you. Its really help me.
ReplyDeleteHi Is there any way to download only a specific collection?
ReplyDeleteThank you... I have a question: will it also export/import the indexes?
ReplyDelete