Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble with Firebase security rule involving .getPriority()
    primarykey
    data
    text
    <p>I'm trying to let user set the priority of an item with "ref.setPriority(priority);" but I also want to make sure they can't set it to less than "current_priority -10".</p> <p>But this expression:</p> <pre><code>".write": "data.getPriority() - newData.getPriority() &gt; 10" </code></pre> <p>is giving me an error "expression: left operand is not a number". </p> <p>However:</p> <pre><code>data.getPriority().length - newData.getPriority().length &gt;=1 </code></pre> <p>Sort of works (no errors on saving but gives me 'permission denied' when I try to set the priority)</p> <p>Does Firebase assume the priority is not a number? If so, is there a way to get around that?</p> <p>EDIT: I'll add the actual JSON from Firebase for one item:</p> <pre><code>"http_www_latimes_com_local_lanow_la_me_ln_two_police_officers_shot_in_inglewood_20131127_0_1591070_story_track_rss" : { ".priority" : 4458.0, "date" : 1385616825, "url" : "http://www.latimes.com/local/lanow/la-me-ln-two-police-officers-shot-in-inglewood-20131127,0,1591070.story", "discuss" : "http://www.reddit.com/r/news/comments/1rlmzy/two_inglewood_police_officers_shot_active_shooter/", "small_image" : "http://i.embed.ly/1/display/resize?height=168.75&amp;width=300&amp;url=http%3A%2F%2Fwww.trbimg.com%2Fimg-529660a6%2Fturbine%2Fla-me-ln-two-police-officers-shot-in-inglewood-20131127%2F400%2F16x9&amp;key=6b62489a749d11e1b62e4040d3dc5c07", "title" : "Two Inglewood police officers shot; active shooter in area", "height" : 168.75, "desc" : "Two Inglewood police officers were shot Wednesday afternoon and taken to a local hospital, Inglewood police officials said.", "width" : 300, "id" : "http_www_latimes_com_local_lanow_la_me_ln_two_police_officers_shot_in_inglewood_20131127_0_1591070_story_track_rss" }, </code></pre> <p>so maybe it should be 'root.getPriority()', I'm not sure.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload