Reputation: 15
I have a collection say users and it has a subcollection vehicles(type,vehicleNo etc). I want to get all users who have a two-wheeler(type==two-wheeler). Is this possible with a firestore single query? How can I get those documents?
Upvotes: 0
Views: 63
Reputation: 317467
It's not possible. A query can consider only the documents within a single collection at a time. It can't reach into subcollections. What you will have to do is either copy the required data from the subcollection in the main collection that you need for the query, or compose a whole new collection that you can query. Duplicating data like this is common for NoSQL type databases like Firestore.
Upvotes: 1