Reputation: 501
I've been using Firestore for a while, but never ran into this use-case until now.
My data looks similar to this:
user > [id] > app [c] > metadata [d] > plan [f]
where [id]
= uid, [c]
= collection, [d]
= document.
Would like to only return the users who's plan == silver
for example. Can it even be done?
Upvotes: 0
Views: 45
Reputation: 317948
A query can only return document from the queried collection or subcollection. It's not possible to "join" the documents to those in another collection. If you want to use the query results to find document in another collection (even a parent collection), you will have to make additional queries for those documents.
It's common in nosql type databases to duplicate data among collection so that it requires fewer queries to get the data you're looking for. That's up to you to decide.
Upvotes: 1