【发布时间】:2016-10-07 07:53:45
【问题描述】:
这是我的类别
的数据库结构我想使用 Firebase 规则
防止重复数据这是我的 Firebase 规则
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"categories": {
"$catid": {
".validate": "!root.child(newData.child('type').val()).exists()"
}
}
}
}
当我尝试再次插入 java 时,它会插入 java
的副本如何防止插入重复的类别
【问题讨论】:
-
这里的建议是一样的:你不能用安全规则来确保唯一的值。只有唯一的键。
-
感谢我更新了我的数据结构,它正在工作
标签: firebase firebase-realtime-database firebase-security