【发布时间】:2015-11-13 13:01:36
【问题描述】:
如何在 firebase 规则中检查数组中的值。我正在尝试做这样的事情:
root.child('connections/'+auth.uid).child('friends').child(someFriendId).exists()
所以在当前用户的connections节点下,如果friends数组中存在someFriendId,则允许访问。 'someFriendId' 不是朋友数组的键,它是使用 firebase push() 方法自动生成的 ID。
【问题讨论】:
-
看起来这是 Firebase 安全规则的限制,因此数据应该构造为带有键的对象而不是数组。我不明白为什么会这样,如果您不能对数组的内容使用任何类型的安全性,为什么要启用 $FirebaseArray 和使用 push() 自动生成的密钥。如果有人能详细说明这一点,将不胜感激。