DocumentChange interface

DocumentChange表示对与查询匹配的文档的更改。它包含受影响的文档以及发生的更改类型。

签名:

export declare interface DocumentChange<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> 

特性

财产类型描述
文档查询文档快照<应用程序模型类型,Db模型类型>受此更改影响的文档。
新索引数字紧随此DocumentChange之后的结果集中已更改文档的索引(即假设已应用所有先前的DocumentChange对象和当前的DocumentChange对象)。 “已删除”事件为 -1。
旧索引数字紧接此DocumentChange之前的结果集中已更改文档的索引(即假设已应用所有先前的DocumentChange对象)。 “添加”事件为-1
类型文档更改类型更改的类型(“添加”、“修改”或“删除”)。

文档更改.doc

受此更改影响的文档。

签名:

readonly doc: QueryDocumentSnapshot<AppModelType, DbModelType>;

DocumentChange.newIndex

紧随此DocumentChange之后的结果集中已更改文档的索引(即假设已应用所有先前的DocumentChange对象和当前的DocumentChange对象)。 “已删除”事件为 -1。

签名:

readonly newIndex: number;

文档更改.oldIndex

紧接此DocumentChange之前的结果集中已更改文档的索引(即假设已应用所有先前的DocumentChange对象)。 “添加”事件为-1

签名:

readonly oldIndex: number;

DocumentChange.type

更改的类型(“添加”、“修改”或“删除”)。

签名:

readonly type: DocumentChangeType;