Rau*_*aul 2 firebase firebase-security google-cloud-platform google-cloud-firestore
我一直在尝试使用这些安全规则使子集合中的所有文档完全可读:
match /books {
allow write, update, delete: if false; // This collection cannot be modified
match /sells {
allow read: if true; // All documents and sub-collections of this collection are readable
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试读取 sell 子集合的文档时,我收到 Firebase 权限错误。我究竟做错了什么?
您需要匹配集合中的文档:
match /sells/{doc} {
allow read: if true; // All documents in sells are readable
}
Run Code Online (Sandbox Code Playgroud)
如果您还想匹配sells文档的子集合,可以使用递归通配符,如下所示:
match /sells/{doc=**} {
allow read: if true; // All documents in and sub-collections of sells are readable
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1512 次 |
| 最近记录: |