假设我在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场,是否可能?谢谢
我想suspendedProfile在一个user文档中调用一个只读属性,其中所有其他属性都具有当前登录用户的读/写访问权限.有没有办法用简单的安全规则来做到这一点?
我想到了两个解决方案:
allow write: if request.resource.data.suspendedProfile == null;/secure与集合allow read;内部user文件我认为第一个选项是更好的所有与用户相关的属性都在一个单独的文件中,但我很想听听你的想法.有没有其他更简单的方法来实现这一目标?