Security Firestore筛选器错误:缺少权限或权限不足

Security Firestore筛选器错误:缺少权限或权限不足,security,ionic3,google-cloud-firestore,rules,Security,Ionic3,Google Cloud Firestore,Rules,我正在和Ionic cordova客户一起开发Firestore数据库。以下是我的数据结构: 我想根据ownerId字段筛选我的设计收藏 我试过几条规则,但都给了我机会 错误:缺少权限或权限不足 这是我目前的规则 service cloud.firestore { match /databases/{database}/documents { match /designs/{design} { allow read: if resource.data.ownerId =

我正在和Ionic cordova客户一起开发Firestore数据库。以下是我的数据结构:

我想根据ownerId字段筛选我的设计收藏

我试过几条规则,但都给了我机会

错误:缺少权限或权限不足

这是我目前的规则

service cloud.firestore {
  match /databases/{database}/documents {
    match /designs/{design} {
      allow read: if resource.data.ownerId == request.auth.uid ;
      allow write: if false;
    }
  }
}
这是我的客户代码

AngularFirestore.collection(`designs`).snapshotChanges().map(x => {
            return x.map(y => {
              return y.payload.doc.data() ;
            });
        });

这里的问题是规则不能用作过滤器

如果您尝试阅读一个文档,其中
ownerId==request.auth.id
,那么它将起作用

如果要列出此用户可读的所有文档,则需要根据当前用户ID(此处显示为用户ID)进行筛选:


这里的问题是规则不能用作过滤器

如果您尝试阅读一个文档,其中
ownerId==request.auth.id
,那么它将起作用

如果要列出此用户可读的所有文档,则需要根据当前用户ID(此处显示为用户ID)进行筛选:


天哪,我刚刚花了两个小时调查这件事!天哪,我刚刚花了两个小时调查这件事!
AngularFirestore.collection(`designs`).where('ownerId', '==', userId).snapshotChanges().map(x => {
            return x.map(y => {
              return y.payload.doc.data() ;
            });
        });