我有一个集合/calendars和一个子集合/events。我正在尝试将查询/events的规则设置为集合组,但似乎无法访问resource.data字段。/calendars/events中的所有文档都有"CalendarId“字段,为了测试目的,我设置了如下规则:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{path=**}/events/{eventId} {
allow read: if
在提交数据时,我希望确保我的客户端不能持久化随机字段。 同时,我想让我的应用程序尽可能简单,并且我试图只使用firestore规则和/或索引(即不使用一些服务器端express)。有可能吗? 我知道如何检查字段的存在和类型: rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /example/{exampleId} {
allow create: if "fieldOK" in request.res
这应该是相当简单的,但是我遇到了一个在Firestore中读取分层数据的问题。以官方文档中的例子为例,并对其进行一点修改,我已经……
service cloud.firestore {
match /databases/{database}/documents {
match /cities/{city} {
allow read: if resource.data.visible == true;
// Explicitly define rules for the 'landmarks' subcollection
我有一个Firestore,其中设置了结构:registrations/[userId]/symptoms/[documentId]/[some kind of document]
我之所以这样做,是因为用户应该只读取自己的症状,因此我认为在userId上分离这些症状会更好。该文档不了解userId。
当我现在将它导出到BigQuery时,我不知道如何获得文档和userId之间的关联,也许这是不可能的。
我应该把它改为:symptoms/[documentId]/[some kind of document with a userId]
然后只过滤出特定userId的文档?阅读的数量有什么不同
我有一个Routines集合,其中不允许具有字段programId的文档可读性。
我有一条消防规则:
match /Routines/{routineId=**} {
allow write: if false;
allow read: if !('programId' in resource.data);
}
当我从这个集合中得到一个文档时,规则可以正常工作,但是当我得到整个集合时,我得到了所有的文档,甚至有一个programId集的文档。因此,该规则似乎不适用于集合。
我得到了这样的收藏:
const res = await firebase.firesto