【发布时间】:2021-08-23 07:56:00
【问题描述】:
我正在尝试根据用户的 uid 请求用户的 customerId,以便我可以使用该 customerId 来根据其他集合的非规范化结构在应用程序中进行未来读取/写入。
match /customers/{customerId} {
allow read: if debug(/databases/$(database)/documents/users/$(request.auth.uid) in resource.data.users);
// allow list: if request.auth.uid in resource.data.users;
allow write: if false;
}
const userRef = firestore
.collection("users")
.doc("AKwPD9IUq8oyLYb454XaA7JUmpyO")
await firestore
.collection("customers")
.where("users", "array-contains", userRef).get()
Firebase 错误: 空值错误。对于“列表”@ L13,空值错误。对于“列表”@ L14
当我更改为read: true 或list: true 时,允许查询(所以我知道这是正确的match,只是规则错误)
【问题讨论】:
标签: javascript firebase google-cloud-firestore firebase-security