Reputation: 269
what is the syntax for using the auth.uid as item path in firestore
in firebase it would be this:
data.child(auth.uid).val() == 'admin'
I tried in firestore this, but is not working
resource.data.request.auth.uid == 'admin'
thans
Upvotes: 0
Views: 29
Reputation: 50830
resource.data
is an object containing the data of document being read/written. If you are trying to read values of a field in that document then try:
allow read: if resource.data[request.auth.uid] == 'admin'
This rule will allow read operation if the field request.auth.uid
is admin
.
Upvotes: 2