I have a document "user" which has a key called "photos". Here is an array of strings being saved, namely the IDs of the "photo" documents.
I want to query "user" by this "photos" field: I want all users who have this ID in the "photos" property.
Is this possible through firestore?
See Henry's answer, as we've no made Array Contains queries available.
Unfortunately not yet, although it's on our roadmap.
In the meantime, you'll need to use a map instead, in the form of:
photos: {
id1: true
id2: true
}
Now you can find all users with id1 by filtering by photos.id1 == true
.
Read more about querying such sets in the Firebase documentation.