【问题标题】:Firebase validation basic integer comparison fails in simulatorFirebase 验证基本整数比较在模拟器中失败
【发布时间】:2018-01-18 13:23:03
【问题描述】:

我使用 firebase 有一段时间了,但到目前为止从未使用过 validate 属性,我无法理解这个简单验证失败的原因(尝试了几种变体以及数据/规则/两者中的“0”)

有什么想法吗?

【问题讨论】:

  • 谢谢,我改为:“.validate”:“newData.val().mutex1==0”,但失败并显示:Simulation failed - Line 9: No such method/property 'mutex1 '。
  • 对不起我的错误,正确的是".validate" : "newData.child('mutex1').val() == 0"
  • 您必须为此使用通配符。请参阅下面的答案。

标签: firebase firebase-realtime-database firebase-security


【解决方案1】:

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

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

欲了解更多信息:Firebase Security

【讨论】:

    猜你喜欢
    • 2015-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多