Cloud Firestore security rules: how to check if property exists?

Viewed 1920

I need to check is property exists in document in store. allow update, delete: if resource.data.uid; in code above i have error "Property uid is undefined on object.", so how i can check is uid in data?

1 Answers

To check if the document contains a specific field, I use in:

allow update, delete: if 'uid' in resource.data;
Related