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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -