涉及.getPriority()的Firebase安全规则出现问题

涉及.getPriority()的Firebase安全规则出现问题,firebase,angularfire,Firebase,Angularfire,我试图让用户用“ref.setPriority(priority);”设置项目的优先级,但我还想确保他们不能将其设置为小于“current_priority-10” 但这句话: ".write": "data.getPriority() - newData.getPriority() > 10" 给我一个错误“表达式:左操作数不是数字” 然而: data.getPriority().length - newData.getPriority().length >=1 工作类型(保存

我试图让用户用“ref.setPriority(priority);”设置项目的优先级,但我还想确保他们不能将其设置为小于“current_priority-10”

但这句话:

".write": "data.getPriority() - newData.getPriority() > 10"
给我一个错误“表达式:左操作数不是数字”

然而:

data.getPriority().length - newData.getPriority().length >=1
工作类型(保存时没有错误,但当我尝试设置优先级时会给我“权限被拒绝”)

Firebase是否假定优先级不是数字?如果是的话,有没有办法解决这个问题

编辑:我将为一个项目添加来自Firebase的实际JSON:

"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&width=300&url=http%3A%2F%2Fwww.trbimg.com%2Fimg-529660a6%2Fturbine%2Fla-me-ln-two-police-officers-shot-in-inglewood-20131127%2F400%2F16x9&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"
},

因此,我不确定它应该是“root.getPriority()”。

看起来我们的规则验证中有一个bug。您尝试的表达式(“data.getPriority()-newData.getPriority()>10”)应该是合法的,并且可以执行您想要的操作,但它当前被错误地拒绝。我们已经做了修复,但要到下周才能投入生产。很抱歉给您带来不便

实际的优先事项是什么?串?数字?空值?这是你问题的一个重要组成部分。它们是数字,例如:“.priority”:4458.0Heh,很抱歉让你在感恩节工作!我保证有一天我会停止破坏东西。