gdg-x / hoverboard

Conference website template
https://hoverboard-master.web.app
Other
1.11k stars 1.09k forks source link

Allow dump of the entire Firestore with firestore utils #589

Open zasadnyy opened 5 years ago

zasadnyy commented 5 years ago

As a Hoverboard user, I'd like to be able to dump the entire database into a JSON file using firestore utils.

At the moment firestore utils throw an error:

 ~/dev/repos/personal/dfua18 ⮀ dfua-test●● ⮀ 312d14h32m ⮀ yarn firestore:copy "" firestore-dump-03-06-19.json
yarn run v1.7.0
$ babel-node ./internals/firestore-copy-data '' firestore-dump-03-06-19.json
Error! 💩 Error: Argument "collectionPath" is not a valid ResourcePath. Path must be a non-empty string.
    at Object.exports.(anonymous function) [as isResourcePath] (/Users/vitalik/dev/repos/personal/dfua18/node_modules/@google-cloud/firestore/build/src/validate.js:89:23)
    at Firestore.collection (/Users/vitalik/dev/repos/personal/dfua18/node_modules/@google-cloud/firestore/build/src/index.js:349:18)
    at fetchDataFromFirestore (/Users/vitalik/dev/repos/personal/dfua18/internals/firestore-utils.js:43:22)
    at getData (/Users/vitalik/dev/repos/personal/dfua18/internals/firestore-utils.js:12:10)
    at /Users/vitalik/dev/repos/personal/dfua18/internals/firestore-copy-data.js:5:15
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at Object.<anonymous> (/Users/vitalik/dev/repos/personal/dfua18/node_modules/@babel/node/lib/_babel-node.js:221:23)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
✨  Done in 0.75s.
cortinico commented 5 years ago

Hey @zasadnyy

Have you seen the https://github.com/gdg-x/hoverboard/blob/master/docs/tutorials/firebase-utils.md page? Is this a feature request or a bug report?

If it's feature request, I agree. Would be really handy to have it. I had to code a custom solution for our DevFest Pisa 2019.

If it's a bug report, please note that you can't invoke firestore:copy with an empty string. It needs to be a valid path within your Firestore.