【发布时间】:2018-03-15 11:14:09
【问题描述】:
我有以下格式的数据
我喜欢这样配置规则
- 允许在消息块中创建新项目(使用唯一键)
- 不允许删除现有项目(“foo bar”和“hello world”)
- 允许更新现有消息的子项(“赞”和“视图”)
我尝试了以下规则
{
"rules": {
".read": true,
"message": {
//allow writing only if the new item does not exist
".write": "!data.exists() && newData.exists()"
//what write rule do I need for
//insert data with unique keys
//allow update of its child (likes and views)
// of existing data
}
}
}
但如果消息已经包含项目,它就不起作用。
【问题讨论】:
标签: firebase firebase-realtime-database firebase-security