Skip to content

About

Handy Firestore utils

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

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.

Setup

  • Go to Project settings / Service accounts / Firebase admin SDK
  • Select Node.js and click “Generate new private key“
  • Download file
  • Rename file to “serviceAccount.json” and put this file to project root

Save collection/doc to file

    npm run firestore:copy sourcePath fileToSave.json
Examples:

Save a collection

    npm run firestore:copy config/scheme/pages pages-scheme.json

Save a document

    npm run firestore:copy config/backup backup.json

Load a file to collection/doc

    npm run firestore:copy fileToLoad.json destinationPath
Examples:

Load to collection

    npm run firestore:copy pages-scheme.json config/scheme/pages

Load a document

    npm run firestore:copy backup.json config/backup

Copy collection->collection or doc->doc

    npm run firestore:copy sourcePath destinationPath
Examples:

Copy a collection

    npm run firestore:copy pages config/scheme/pages

Copy a document

    npm run firestore:copy pages/about postponed/draft/pages/about

About

Handy Firestore utils

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages