Abhay
Abhay

Reputation: 23

search a doc with its ID in 2 different Firestore collection at backend in flutter

I have the ID of the DOC, is there any query to search that doc in 2 different collection, am doing this check in my code but is there any firebase query to do same.

Upvotes: 0

Views: 162

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599591

If the collections that you want to search have the same name, you can use a collection group query to search both of then (well actually, you'll be searching all collections with that name).

If the collections have different names, there is no way to search them both with a single query. You'll have to do a separate query for each collection, and then merge the results in your application code.

Upvotes: 1

Related Questions