Jump to top

QuerySnapshot

interface

A QuerySnapshot contains zero or more QueryDocumentSnapshot objects representing the results of a query. The documents can be accessed as an array via the docs property or enumerated using the forEach method. The number of documents can be determined via the empty and size properties.

Properties

docs

</>

An array of all the documents in the QuerySnapshot.

empty

</>

True if there are no documents in the QuerySnapshot.

empty: boolean;

metadata

</>

Metadata about this snapshot, concerning its source and if it has local modifications.

metadata: SnapshotMetadata;

query

</>

The query on which you called get or onSnapshot in order to get this QuerySnapshot.

query: Query;

size

</>

The number of documents in the QuerySnapshot.

size: number;

Methods

docChanges

</>

Returns an array of the documents changes since the last snapshot. If this is the first snapshot, all documents will be in the list as added changes.

docChanges(options?: SnapshotListenOptions): DocumentChange[];

forEach

</>

Enumerates all of the documents in the QuerySnapshot.

forEach(callback: (result: QueryDocumentSnapshot, index: number) => void, thisArg?: any): void;

isEqual

</>

Returns true if this QuerySnapshot is equal to the provided one.

isEqual(other: QuerySnapshot): boolean;