2017-08-10 30 views
2

我正在使用firebase一段时间,但从来没有使用验证属性,直到现在,我无法理解为什么这个简单验证失败的原因(尝试了几个变化以及'0'在数据/规则/两)Firebase验证基本整数比较在模拟器中失败

enter image description here

任何想法?

+0

谢谢,变更为: “.validate”: “newData.val()mutex1 == 0。”, 和它失败:模拟失败 - 第9行:没有这样的方法/属性'mutex1'。 – tomermes

+1

对不起,我的错误,正确的是'“.validate”:“newData.child('mutex1')。val()== 0”' –

+0

它的工作表示感谢! – tomermes

回答

4

您需要在您的互斥量路径下输入通配符。

{ 
    "rules": { 
    ".read": true, 
    ".write": true, 
     "selenium_tasks":{ 
     "mutexes":{ 
      "$mutex":{ 
      ".validate": "newData.val() == 0", 
      } 
     } 
     } 
    } 
} 

enter image description here

更多信息:Firebase Security