Skip to content Skip to sidebar Skip to footer

Firebase Firestore Securitty Rule Based On Attribute Value

I am trying to write security rules on my Firestore database to allow read of documents within a collection with status value as published. But, it does not allow read for any docu

Solution 1:

You have missed one specific point in the doc: your query fails "because it does not include the same constraints as your security rules" and "security rules are not filters". See https://firebase.google.com/docs/firestore/security/rules-query#queries_and_security_rules

In other words, your query should be like:

const query = db.collection('articles').where("status", "==", "published")...

Post a Comment for "Firebase Firestore Securitty Rule Based On Attribute Value"