Firebase Firestore安全规则。允许读取完整集合(文档和子集合)
我一直在尝试使用以下安全规则使子集合中的所有文档完全可读:Firebase Firestore安全规则。允许读取完整集合(文档和子集合),firebase,google-cloud-platform,google-cloud-firestore,firebase-security,Firebase,Google Cloud Platform,Google Cloud Firestore,Firebase Security,我一直在尝试使用以下安全规则使子集合中的所有文档完全可读: 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
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
}
}
但是,当我尝试读取sell子集合的文档时,我得到了Firebase权限错误。我做错了什么?您需要:
如果您还想匹配
销售
文档的子集合,可以使用如下方法:
match /sells/{doc=**} {
allow read: if true; // All documents in and sub-collections of sells are readable
}
match /sells/{doc=**} {
allow read: if true; // All documents in and sub-collections of sells are readable
}