Reputation: 1079
In my users collection
I have a few users where a field is present which is called startupData
field and now I want to make these documents public. So I am trying to make rules for it but so far no luck.
This is my document with the field.
These are the rules that i have created so far
match /databases/{database}/documents {
match /users/{uid} {
allow read: if request.auth.uid == uid;
allow read: if get(/databases/$(database)/documents/users/{document=**}).data.startupData
}
}
Upvotes: 0
Views: 529
Reputation: 683
You probably need to use the hasAll
keyword.
match /databases/{database}/documents {
match /users/{uid} {
allow read: if request.auth.uid == uid;
allow read: if resource.data.keys().hasAll(['startupData'])
}
}
Upvotes: 2