Magomed.Khamidov
Magomed.Khamidov

Reputation: 53

How can i get every collection from every single document in firebase? (React)

So i have a post collection. Inside the "post" collection i have documents which has another collection called "likes".

So i want to get every single collection from every document at the same time and map them after. Is there a way to do that?

Because in Firebase you can only get a collection from just one document, but i want to get every collection from every single document.

Upvotes: 0

Views: 149

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83048

If I correctly understand your question, you should use a Collection Group query. As explained in the doc, a "collection group consists of all collections with the same ID", i.e. likes in your case.

With such a query, you will get all the documents that are in all the likes sub-collections of all the documents in the post collection.

Upvotes: 1

Related Questions