Closed raullarosa closed 6 years ago
Hi @raullarosa. I'm not sure how many subcollections that you have, but there is a way to get subcollection if you have its name. You can put this line of code inside the query for the main collection to get the sub-collection. In this case, my sub-collection name is 'sub'.
db.collection(collectionName).doc(doc.id).collection('sub').get()
.then(snapshot => {
snapshot.forEach(doc => {
console.log(doc.id, '=>', doc.data());
})
})
This is a quick solution in case of you need it. I will come up with a better one later.
how can i export a sub collection in a nested object? for example i have users collection, for export i will get all the users but without the sub collections of them. i want to export users/{userId}/purchase for example, how can i achieve that?
Hi @talpanika6, I added the ability to export the sub-collection. You can check it now.
In an attempt to migrate data from Firestore to the RealtimeDB I was hoping the collections of my data would be placed inside of an object. It seems trivial to accomplish and maybe I'm the only one with this use case so I will be working on this. (First PR coming through so bear with me!)