I have the following structure:
attendanceOptions:
uid: "specificemail@email.com",
uid: "anotherEmail@email.com",
I'm attempting to get the key and value where value is... In example get where anotherEmail@email.com
Here is my attempt:
security rules:
{
"rules": {
".read": true,
".write": true,
"organization": {
"$uid": {
"attendanceOptions": {
".indexOn": ["$uid"]
},
"members": {
".indexOn": ["mStatus"]
}
}
}
}
}
The error I get is
Error saving rules - Line 9: Invalid key: $uid. Index must be either .value or declared on a valid path
Obviously I'm doing something wrong. How can I accomplish this?
If you want to define an index on attendanceOptions
for the value of each child node, you can do that with:
"attendanceOptions": {
".indexOn": [".value"]
},
Also see the Firebase documentation on indexing by value.