SaNtoRiaN
SaNtoRiaN

Reputation: 2202

Firebase security access sibling node's child

I have the following data structure

where count is any integer, I made the following security rule to allow adding users only if the count value is less than for example 5

"users": {
    ".read": true,
    ".write": "root.child('counter').child('count').val() < 5" 
}

but it shows me permission denied. Any other suggestions to access a child of sibling nodes?

Upvotes: 0

Views: 267

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598728

I think you're looking for:

newData.parent().child('counter')... 

instead of root.child('counter'). The difference is that newData contains the... new data.

Upvotes: 2

Related Questions