0
votes

How do I get all the collections from root level?


As I know that Cloud Firestore Console allow to add more than one collection on root level.

I found some solution to get documents of particular collection but I didn't get to know same thing for collections.

Is there any way to get all collection name of root level?

1

1 Answers

1
votes

There is no API in the Firebase SDKs for iterating collections. Similarly, there is no API for iterating subcollections of a document. You must know the name of a collection ahead of time to use it on the client.

If you're using the Admin SDK for Node, which wraps the Google Cloud Firestore SDK, there is an API Firestore.getCollections() that will do what you want.