I\'ve got a data structure like this:
How can I access /Restaurant/-KK37k6g5cYYippEHpZ3/User/-KK37k6g5cYYippEHpZ4/id
\'s value within the fireba
Not sure if I fully understood what you are asking for but here goes my thoughts.
The first problem in your rule is that you are specifying child($id)
but you already are inside the $id
. it is implicit in your data
that you are referring to $id
.
To resolve your main problem you wont need another wildcard. You can just use hasChild
to verify if the auth.uid
is inside restaurant/user
.
"Restaurant": {
"$id": {
".read": "auth.uid != null",
".write": "auth.uid != null && data.child('User').hasChild(auth.uid)"
}
}