Backup specific document with a subcollection in a collection
ccfiel opened this issue · comments
Chris Ian Fiel commented
How can I backup specific document with a subcollection in a collection. I tried this code
const { backup, backups, initializeApp } = require('firestore-export-import')
const serviceAccount = require('./service-account.json')
initializeApp(serviceAccount)
backup('data/00Grg9QoguND4o9PiR2Eb1p23sn2sXXSS').then((data) =>
console.log(JSON.stringify(data))
)
I got this error
Error: Value for argument "collectionPath" must point to a collection, but was "data/00Grg9QoguND4o9PiR2Eb1p23sn2sXXSS". Your path does not contain an odd number of components.
I want to have a selective backup per user Id. Any Advice how to this?
Dale Nguyen commented
For a single node, it's better to use firestore get data method. It's much faster.
https://firebase.google.com/docs/firestore/query-data/get-data