Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud firestore 将通配符变量传递到path的Firestore安全规则_Google Cloud Firestore_Firebase Security - Fatal编程技术网

Google cloud firestore 将通配符变量传递到path的Firestore安全规则

Google cloud firestore 将通配符变量传递到path的Firestore安全规则,google-cloud-firestore,firebase-security,Google Cloud Firestore,Firebase Security,我有以下安全规则: match /collection1/{doc_id} { allow read: if (get(/databases/$(database)/documents/collection2/$(doc_id)).author == request.auth.uid); } 我正在做的是尝试将通配符变量从父路径doc\u id传递到get方法的路径中。此文档在collection1中的读取权限取决于另一个集合c

我有以下安全规则:

    match /collection1/{doc_id} {
      allow read: if (get(/databases/$(database)/documents/collection2/$(doc_id)).author == 
                  request.auth.uid);
    }
我正在做的是尝试将通配符变量从父路径
doc\u id
传递到
get
方法的路径中。此文档在
collection1
中的读取权限取决于另一个集合
collection2
中具有相同id的文档的
author
字段。我不相信我将
doc\u id
作为
$(doc\u id)
传递的方式是正确的,因为我得到一个错误:
属性作者在对象上未定义


我也试过
(doc\u id)
\doc\u id
,但它们的语法错误。那么,如何将通配符变量传递到路径?

其中缺少一个
数据,这是获取文档字段所需的:

get(/databases/$(database)/documents/collection2/$(doc_id)).data.author
啊,
get(path)返回rules.firestore.Resource
我忘记了
data
。谢谢你,弗兰克