我需要一些帮助来制定 Firestore 工作的安全规则。
这些是我的firestore规则:
service cloud.firestore {
match /databases/{database}/documents {
match /orders/{orderID} {
allow read, update: if request.auth.uid == resource.data.buyerId || request.auth.uid == resource.data.sellerId;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的订单集合:
orders: {
sellerId: 'some-id',
createdAt: timestamp,
buyerId: 'some-id'
}
Run Code Online (Sandbox Code Playgroud)
它应该返回来自订单集合的所有文档,其中买方 ID 或卖方 ID 等于授权用户 (request.auth.uid)。
但上述规则没有按预期工作。