Class DocumentChange (4.9.8)

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

DocumentChange

Package

@google-cloud/firestore!

Constructors

(constructor)(type, document, oldIndex, newIndex)

  constructor 
 ( 
 type 
 : 
  
 DocumentChangeType 
 , 
  
 document 
 : 
  
 QueryDocumentSnapshot<T> 
 , 
  
 oldIndex 
 : 
  
 number 
 , 
  
 newIndex 
 : 
  
 number 
 ); 
 

Constructs a new instance of the DocumentChange class

Parameters
Name Description
type DocumentChangeType

'added' | 'removed' | 'modified'.

document QueryDocumentSnapshot <T>

The document.

oldIndex number

The index in the documents array prior to this change.

newIndex number

The index in the documents array after this change.

Properties

doc

  get 
  
 doc 
 () 
 : 
  
 QueryDocumentSnapshot<T> 
 ; 
 

The document affected by this change.

{QueryDocumentSnapshot} DocumentChange#doc

Property Value
Type Description
QueryDocumentSnapshot <T>

newIndex

  get 
  
 newIndex 
 () 
 : 
  
 number 
 ; 
 

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

{number} DocumentChange#newIndex

Property Value
Type Description
number

oldIndex

  get 
  
 oldIndex 
 () 
 : 
  
 number 
 ; 
 

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

{number} DocumentChange#oldIndex

Property Value
Type Description
number

type

  get 
  
 type 
 () 
 : 
  
 DocumentChangeType 
 ; 
 

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

{string} DocumentChange#type

Property Value
Type Description
DocumentChangeType

Methods

isEqual(other)

  isEqual 
 ( 
 other 
 : 
  
 firestore 
 . 
 DocumentChange<T> 
 ) 
 : 
  
 boolean 
 ; 
 

Returns true if the data in this DocumentChange is equal to the provided value.

Parameter
Name Description
other FirebaseFirestore.DocumentChange <T>

The value to compare against. true if this DocumentChange is equal to the provided value.

Returns
Type Description
boolean
Create a Mobile Website
View Site in Mobile | Classic
Share by: