How to access sub collection in angular and firestore

I am trying to access a sub-collection inside a document using cloud firestore in angular but it isn't showing the sub-collections and only shows fields and its values

Here is the code. I want to get subCollection names.

this.afs.collection(`users/${this.user.uid}/Root`).doc('Folder').valueChanges().subscribe(item => {

1 answer

  • answered 2018-11-08 08:13 Renaud Tarnec

    At the time of writing, the only libraries/SDKs that allow listing the sub-collections of a document are the ones that are used in "trusted server environments" like the ones for Node.js, Java, PHP, etc., see the doc about this:

    Retrieving a list of collections is not possible with the mobile/web client libraries

    A workaround is to store the sub-collection name(s) in a field (e.g. an array) in the document.