相关疑难解决方法(0)

如何仅允许公开访问firestore文档的特定字段

假设我在firestore数据库中有这个结构:

collection[
  document: {
    x: 'x',
    y: 'y'
  }
]
Run Code Online (Sandbox Code Playgroud)

我有这个firebase规则:

service cloud.firestore {
  match /databases/{database}/documents {
    match /collection/{document} {
      allow read: if true;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但是这个规则暴露了document上面的整体collection,我想要做的只是暴露x场,是否可能?谢谢

firebase firebase-realtime-database google-cloud-firestore

6
推荐指数
1
解决办法
1830
查看次数

我可以限制 firestore 数据库中的某些字段只能由 firebase 管理员获取吗?

我在 firestore 中有一个用户集合,它存储了一些我不想向用户透露的用户信息(例如会话 ID)。所以我的问题是,是否可以只允许 firebase 管理员获取文档的某些字段,而如果任何用户通过身份验证,则可以获取其余字段?Firebase 安全规则是否有可能?

firebase firebase-security google-cloud-firestore

1
推荐指数
1
解决办法
1311
查看次数