在 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)
有什么办法可以使这项工作?