collection/document/collection/document
user/teamname/username/info
I want to list teamname document
's collections.I need collection names. Below functions return undefined.
firestore.collection('user')
.doc('teamname').onSnapshot((data) => { console.log(data) });
firestore.collection('user')
.doc('teamname').get().then((data) => { console.log(data) });
log:
_data:undefined
_metadata: {}
_ref:{}
It is mentioned on the Firestore documentation:
Retrieving a list of collections is not possible with the mobile/web client libraries. You should only look up collection names as part of administrative tasks in trusted server environments. If you find that you need this capability in the mobile/web client libraries, consider restructuring your data so that subcollection names are predictable.
Methods to retrieve subcollections are only available on server libraries (Java, Nodes.js and Go). You can't yet list subcollections with client libraries.
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