I have a problem setting security rules in Firebase. I have this structure:
"notes": {
"1": {
"userId": "user_1",
"text": "note text"
},
"2": {
"userId": "user_1",
"text": "another note"
},
"3": {
"userId": "user_2",
"text": "some note text"
},
"4": {
"userId": "user_3",
"text": "something"
}
}
I want to retrieve all notes, for logged in user by his auth.uid variable in security rules. When user with uid user_1 is logged in, and call
ref.on("notes", function...)
I want he will get only his notes. How to set rules for it?