命名空間: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。