firestore namespace

功能

功能描述
onDocumentCreated(文檔,處理程序)在 Firestore 中建立文件時觸發的事件處理程序。
onDocumentCreated(選擇,處理程序)在 Firestore 中建立文件時觸發的事件處理程序。
onDocumentDeleted(文檔,處理程序)在 Firestore 中刪除文件時觸發的事件處理程序。
onDocumentDeleted(選項,處理程序)在 Firestore 中刪除文件時觸發的事件處理程序。
onDocumentUpdated(文檔,處理程序)當 Firestore 中更新文件時觸發的事件處理程序。
onDocumentUpdated(選項,處理程序)當 Firestore 中更新文件時觸發的事件處理程序。
onDocumentWritten(文檔,處理程序)在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。
onDocumentWritten(選項,處理程序)在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。

課程

班級描述
改變用於更改狀態的事件的 Cloud Functions 接口,例如即時資料庫或 Cloud Firestore onWriteonUpdate事件。有關用於構造Change物件的格式的更多信息,請參見下文。

介面

介面描述
文件選項DocumentOptions 使用提供的文件以及可選的資料庫和命名空間擴充 EventHandlerOptions。
Firestore事件包含 DocumentSnapshot 或更改的 CloudEvent

類型別名

類型別名描述
文件快照Firestore 文件快照
查詢文件快照Firestore 查詢文件快照

firestore.onDocumentCreated()

在 Firestore 中建立文件時觸發的事件處理程序。

簽名:

export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
文件文件要觸發的 Firestore 文件路徑。
處理程式(活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次建立 Firestore 時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>

firestore.onDocumentCreated()

在 Firestore 中建立文件時觸發的事件處理程序。

簽名:

export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
選擇文件選項<文件>可以在單一事件處理函數上設定的選項。
處理程式(活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次建立 Firestore 時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>

firestore.onDocumentDeleted()

在 Firestore 中刪除文件時觸發的事件處理程序。

簽名:

export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
文件文件要觸發的 Firestore 文件路徑。
處理程式(活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 刪除時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>

firestore.onDocumentDeleted()

在 Firestore 中刪除文件時觸發的事件處理程序。

簽名:

export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
選擇文件選項<文件>可以在單一事件處理函數上設定的選項。
處理程式(活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 刪除時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>

firestore.onDocumentUpdated()

當 Firestore 中更新文件時觸發的事件處理程序。

簽名:

export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
文件文件要觸發的 Firestore 文件路徑。
處理程式(活動: FirestoreEvent <改變<查詢文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 更新時執行的事件處理程序。

返回:

雲函數< Firestore事件<改變<查詢文件快照> |未定義, ParamsOf <文件>>>

firestore.onDocumentUpdated()

當 Firestore 中更新文件時觸發的事件處理程序。

簽名:

export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
選擇文件選項<文件>可以在單一事件處理函數上設定的選項。
處理程式(活動: FirestoreEvent <改變<查詢文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 更新時執行的事件處理程序。

返回:

雲函數< Firestore事件<改變<查詢文件快照> |未定義, ParamsOf <文件>>>

firestore.onDocumentWritten()

在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。

簽名:

export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
文件文件要觸發的 Firestore 文件路徑。
處理程式(活動: FirestoreEvent <改變<文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 建立、更新或刪除時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<改變<文件快照> |未定義, ParamsOf <文件>>>

firestore.onDocumentWritten()

在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。

簽名:

export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;

參數

範圍類型描述
選擇文件選項<文件>可以在單一事件處理函數上設定的選項。
處理程式(活動: FirestoreEvent <改變<文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何>每次發生 Firestore 建立、更新或刪除時都會執行的事件處理程序。

返回:

雲函數< Firestore事件<改變<文件快照> |未定義, ParamsOf <文件>>>

firestore.DocumentSnapshot

Firestore 文件快照

簽名:

export type DocumentSnapshot = firestore.DocumentSnapshot;

firestore.QueryDocumentSnapshot

Firestore 查詢文件快照

簽名:

export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;