Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 1.18 KB

firebase-utils.md

File metadata and controls

65 lines (43 loc) · 1.18 KB

Firestore Utils

At the moment Firestore admin panel doesn't allow to export/import data from their DB. These scripts allow you to load data on your machine, edit and bring it back. See examples to learn how it works.

Save collection/doc to file

    npm run firestore:copy sourcePath fileToSave.json

Examples:

Save a collection

    npm run firestore:copy partners/1/items general-partners.json

Save a document

    npm run firestore:copy partners/1/items/000 gdg-lviv-partner.json

Load a file to collection/doc

    npm run firestore:copy fileToLoad.json destinationPath

Examples:

Load to collection

    npm run firestore:copy general-partners.json partners/1/items

Load a document

    npm run firestore:copy gdg-lviv-partner.json partners/1/items/000

Copy collection->collection or doc->doc

    npm run firestore:copy sourcePath destinationPath

Examples:

Copy a collection

    npm run firestore:copy speakers backups/08-07-2018/speakers

Copy a document

    npm run firestore:copy speakers/yonatan_levin backups/08-07-2018/speakers/yonatan_levin