gpt4 book ai didi

firebase - Firestore 安全规则。允许阅读完整集合(文档和子集合)

转载 作者:行者123 更新时间:2023-12-02 19:08:59 26 4
gpt4 key购买 nike

我一直在尝试使用这些安全规则使子集合中的所有文档完全可读:

 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 documents in the collection :

 match /sells/{doc} {
allow read: if true; // All documents in sells are readable
}

如果您还想匹配 sells 文档的子集合,您可以使用 recursive wildcard像这样:

 match /sells/{doc=**} {
allow read: if true; // All documents in and sub-collections of sells are readable
}

关于firebase - Firestore 安全规则。允许阅读完整集合(文档和子集合),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64617338/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com