DocumentChange interface

ADocumentChange represents a change to the documents matching a query. It contains the document affected and the type of change that occurred.

Signature:

exportdeclareinterfaceDocumentChange<AppModelType=DocumentData,DbModelTypeextendsDocumentData=DocumentData>

Properties

PropertyTypeDescription
docQueryDocumentSnapshot<AppModelType, DbModelType>The document affected by this change.
newIndexnumberThe index of the changed document in the result set immediately after thisDocumentChange (i.e. supposing that all priorDocumentChange objects and the currentDocumentChange object have been applied). Is -1 for 'removed' events.
oldIndexnumberThe index of the changed document in the result set immediately prior to thisDocumentChange (i.e. supposing that all priorDocumentChange objects have been applied). Is-1 for 'added' events.
typeDocumentChangeTypeThe type of change ('added', 'modified', or 'removed').

DocumentChange.doc

The document affected by this change.

Signature:

readonlydoc:QueryDocumentSnapshot<AppModelType,DbModelType>;

DocumentChange.newIndex

The index of the changed document in the result set immediately after thisDocumentChange (i.e. supposing that all priorDocumentChange objects and the currentDocumentChange object have been applied). Is -1 for 'removed' events.

Signature:

readonlynewIndex:number;

DocumentChange.oldIndex

The index of the changed document in the result set immediately prior to thisDocumentChange (i.e. supposing that all priorDocumentChange objects have been applied). Is-1 for 'added' events.

Signature:

readonlyoldIndex:number;

DocumentChange.type

The type of change ('added', 'modified', or 'removed').

Signature:

readonlytype:DocumentChangeType;

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-07-07 UTC.