我找不到在Firestore安全规则的路径中使用连字符或破折号的方法。我收到此错误消息:“意外' - '”
它仅适用于在线规则编辑器/模拟器,但在尝试使用Firebase CLI(firebase deploy --only firestore:rules)部署.rules文件时出现错误。
我尝试在超级集合名称(路径)周围使用单引号。关于这个问题我在互联网上找不到任何东西。
service cloud.firestore {
match /databases/{database}/documents {
// Match any document in the 'oversea-users' collection
match /oversea-users/{oversea-user} {
allow read: ... condition ...;
}
}
}
我发现我的错误仅在“catch”对象名称中,而不在路径中。必须在{}之间使用overseaUsers而不是oversea-user。
service cloud.firestore {
match /databases/{database}/documents {
// Match any document in the 'overseaUsers' collection
match /oversea-users/{overseaUsers} {
allow read: ... condition ...;
}
}
}