Unable to get subCollection data if setting queryCollection in export options
leoleelf opened this issue · comments
Leo Lee commented
If we customize queryCollection
in export options
to get partial data in the collection and there are sub-collection data in the documents, the sub-collection data will not be included in the exported file.
Environment
Steps to reproduce
-
Import the sample file: firestore-backup-restore/import-array-to-firestore.json at dev · dalenguyen/firestore-backup-restore
-
export data with reproduce.js
// reproduce.js // import and initializeFirebaseApp const options = { queryCollection: collectionRef => collectionRef.where('name', '==', 'Dale Nguyen').get(), }; backup('test', options).then(data => console.log(JSON.stringify(data, null, 2)));
Expected result
{
"test": {
"00cbe770-5632-11ed-aa38-1f8d2f865f55": {
"name": "Dale Nguyen",
"email": "dale@dalenguyen.me",
"subCollection": {
"test/00cbe770-5632-11ed-aa38-1f8d2f865f55/details": {
"01966360-5632-11ed-aa38-1f8d2f865f55": {
"dogId": "2",
"dogName": "hello"
},
"01d36c60-5632-11ed-aa38-1f8d2f865f55": {
"dogName": "lala",
"dogId": "2"
}
}
}
}
}
}
Actual result
{
"test": {
"00cbe770-5632-11ed-aa38-1f8d2f865f55": {
"email": "dale@dalenguyen.me",
"name": "Dale Nguyen",
"subCollection": {
"test/00cbe770-5632-11ed-aa38-1f8d2f865f55/details": {}
}
}
}
}
Dale Nguyen commented
Fixed in v1.3.5