Reputation: 32915
Using the "A map of values" query method documented in https://firebase.google.com/docs/firestore/solutions/arrays
If I have this:
db.collection('posts')
.where(`editorUids.${currentUser.uid}`, '==', true)
How would the security rule look like for restricting posts
collection to only allow list
if editorUids.x == true
, where x
is request.auth.uid
?
Upvotes: 0
Views: 529
Reputation: 317948
match /posts/{post} {
allow list: if resource.data[request.auth.uid] == true;
}
Upvotes: 2