How to write to Firebase table only if its greater than current value in table -
i need update table level value in firebase score table if table value less value being posted update. keyoflevel
value never decreases.
since client side involved calls fetch , check. need in rules tab of firebase. , don't know how write rules.
eg:
score: { "1234567890": { coinskey: 1000, keyoflevel: 5 } }
where 123456789 user id.
you might want write security rules this.
{ "rules": { "score": { "$userid": { "keyoflevel": { ".validate": "!data.exists() || data.val() < newdata.val()" } } } } }
in place of .validate
can use .write
Comments
Post a Comment