I have a data storaged in firestone like this:
The members field storage two others fields, admin and viewers, and i need to restrict the read function only to the viewer member, in the rules of my firestone database i did this
service cloud.firestore { match /databases/{database}/documents { match /constructions/{construction=**} { function canRead() { return resource.data.members.viewer[request.auth.uid] } allow read: if canRead() allow write: if request.auth != null } } }