小编Ujj*_*dha的帖子

Firestore 安全规则:检查不存在(/collection/document)

在 firebase firestore 安全规则中,我只想在特定文档不存在时才允许请求。我的代码是:

match /users/{user_id} {
 allow create: if !exists(/databases/$(database)/merchants/$(request.auth.uid));
}
Run Code Online (Sandbox Code Playgroud)

我很确定该文件不存在,但它不起作用。双方exists()!exists()提供虚假不知何故,也许!exists()带来了一些错误。
我什至尝试过:

match /users/{user_id} {
 allow create: if exists(/databases/$(database)/merchants/$(request.auth.uid)) == false;
}
Run Code Online (Sandbox Code Playgroud)

有什么办法可以使这项工作?

firebase firebase-security google-cloud-firestore

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