Reputation: 63
Is it possible to validation firebase rule to accept only key more than highest price?
".validate": "!root.child('data/penawaran/'+$product_id+'/'+$price).exists() && root.child('data/penawaran/'+$product_id.val() > newData.child('price').val() "
When i set new data like this
{
"name":"name",
"price":1000000000,
"member_id":"1",
"product_id":"79",
"created_at":"2020-10-10 10:10:10"
}
always getting error no permission
Upvotes: 0
Views: 68
Reputation: 599686
There is no way in security rules to get a specific-but-unknown key. At the moment you will somehow have to know the key.
The best I can think of is keeping a single global max-key
value somewhere, and then having that be updated at the same time as you create the new child node here.
Upvotes: 1