I am new to cloud firestore in firebase. In my project I created category as collection which is common to all users. But I need to create category as sub collection for each collection. Is it possible?
Any help will be highly appreciated.
It is possible to add sub collection to collection without creating document in firestore in android?
Definitely not! According to the official documentation, the only structure that is permited is as follows:
db.collection('coll').doc('doc').collection('subcoll').doc('subdoc')
There is no way in Firestore to store a collection beneath other collection. So the following line of code is not allowed:
db.collection('coll').collection('subcoll').doc('subdoc') //Not allowed
As there is no way to store a document beneath other document.
db.collection('coll').doc('doc').doc('subdoc') //Not allowed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With