1
我一对夫妇的火力地堡数据库验证规则方面的不明确,以及已经read the documentation a couple of times我的具体情况/问题如下:使用的多个验证规则
我的数据方案是这样的:
{
"aNumber" : 0.794180524700695,
"clicks" : 11
}
我目前的验证规则是这样的:
{
"rules": {
".validate": "newData.child('aNumber').isNumber()",
".read": true,
".write": true
}
}
这个规则目前允许“aNumber的”,如果它是一个数字写,但我会也想验证字段“点击”是一个数字。
我尝试使用和操作员(& &):
{
"rules": {
".validate": "newData.child('aNumber').isNumber() &&
newData.child('clicks').isNumber()",
".read": true,
".write": true
}
}
但是,当我只更新一个字段失败:
{
"aNumber": 2
}
我将如何验证这个? ,一般验证多个独立领域的好方法是什么?
感谢
如果我想把它放在数据库中的特定目录中,我只需要另一个括号括起来? – CraftedGaming