命名空间:firestore

接口

特性

要求

静止的

非空rules.firestore.Request

请求上下文,包括身份验证信息和待处理数据。

资源

静止的

非空rules.firestore.Resource

正在读取或写入的资源。

方法

存在

静止的

存在(路径)返回rules.Boolean

检查文档是否存在。

范围

小路

规则.路径

路径。

值不能为空。

退货

non-null rules.Boolean如果资源存在则为 true。

例子

// Check if another document exists
allow write: if exists(/databases/$(database)/documents/things/other)

存在于之后

静止的

containsAfter(path) 返回rules.Boolean

检查文档是否存在,假设当前请求成功。相当于 getAfter(path) != null。

范围

小路

规则.路径

路径。

值不能为空。

退货

non-null rules.Boolean如果资源存在则为 true。

得到

静止的

get(path) 返回rules.firestore.Resource

获取 firestore 文档的内容。

范围

小路

规则.路径

路径。

值不能为空。

退货

non-null rules.firestore.Resource文档,如果不存在则为null。

例子

// Get the 'thing1' document from the 'things' collection
get(/databases/$(database)/documents/things/thing1)

获取之后

静止的

getAfter(path) 返回rules.firestore.Resource

获取文档的预计内容。返回文档,就好像当前请求已成功一样。对于验证属于批量写入或事务一部分的文档很有用。

范围

小路

规则.路径

路径。

值不能为空。

退货

non-null rules.firestore.Resource文档,如果不存在则为null。