I have a field on my "feed" documents that represents the userId. I want to secure my data such that only the user can read/write feed entries with their own userId. Everything else - allow the user to read/write as long as they are authenticated.
I'm a little new to firestore, but so far I have something like this:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /feed/{feedItem} {
allow read, write: if request.auth.uid == resource.data.userId
}
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
Unfortunately, this is still allowing read/write access to everything, including feed items.