https://www.npmjs.com/package/backup_firestore_database
backup your firestore collection into a json & save each item in a 'backup collection'.
-
get credentials in firebase console, your project > account service > generate new private key
-
copy json in the project folder
Install backup_firestore_database with npm
npm install backup_firestore_database
const backup = require('backup_firestore_database');
// your credentials
const key = require('./key.json');
// init database
const db = backup.init(key);
//copy 'my_collection' collection into backup.json
backup.backupCollectionToJson(db, 'my_collection');
//copy backup.json into 'backup' collection
backup.backupCollection(db, 'my_collection', 'backup');
//copy backup.json into collection
backupJsonToCollection(db, 'my_collection');
//delete 'backup' collection from FireStore
backup.deleteBackupCollection(db, 'backup');
node index.js