in collection A, want to find all documents that has a collection named B that have a document id 1234. Any quick way?
I only know that there is a quick way to find documents that have a specific item in an array which is a property. https://firebase.google.com/docs/firestore/query-data/queries#array_membership
CodePudding user response:
Firestore queries can only order/filter on fields in the documents that they return. There is no way to filter on fields in other documents, or the existence of other documents.
The common way to deal with this is to have a field in the parent document that indicates whether the child document you're looking for exists, and updated that on every relevant write. Then you can use that field to filter the documents in collection A.