I know for every doc
in my collection that request.auth.uid
is in request.resource.data.users
if request.resource.data.foo === bar
// security rule
match /collection/{id}/{document=**} {
allow read: if request.auth.uid in request.resource.data.users;
}
// does not work
const snapshot = await collectionRef.where("foo", "==", "bar").get()
// works
const snapshot = await collectionRef.where("foo", "==", "bar").where("users", "array-contains", userID).get()
Even though every doc in the collection satisfies the security rule firestore throws permission denied
. Once I add the additional users query parameter clause the query works.