AQuerySnapshot contains zero or moreDocumentSnapshot objectsrepresenting the results of a query. The documents can be accessed as anarray via thedocs property or enumerated using theforEach method. Thenumber of documents can be determined via theempty andsizeproperties.
Type parameters
T
Index
Constructors
Private constructor
- new
Query Snapshot():QuerySnapshot ReturnsQuerySnapshot
Properties
docs
An array of all the documents in theQuerySnapshot.
empty
True if there are no documents in theQuerySnapshot.
metadata
Metadata about this snapshot, concerning its source and if it has localmodifications.
query
The query on which you calledget oronSnapshot in order to get thisQuerySnapshot.
size
The number of documents in theQuerySnapshot.
Methods
docChanges
- doc
Changes(options?: SnapshotListenOptions):Array<DocumentChange<T>> Returns an array of the documents changes since the last snapshot. If thisis the first snapshot, all documents will be in the list as added changes.
Parameters
Optional options:SnapshotListenOptions
SnapshotListenOptionsthat control whether metadata-onlychanges (i.e. onlyDocumentSnapshot.metadatachanged) should triggersnapshot events.
ReturnsArray<DocumentChange<T>>
forEach
- for
Each(callback: (result: QueryDocumentSnapshot<T>) =>void, thisArg?: any):void Enumerates all of the documents in the
QuerySnapshot.Parameters
callback:(result:QueryDocumentSnapshot<T>) =>void
A callback to be called with a
QueryDocumentSnapshotforeach document in the snapshot.- (result:QueryDocumentSnapshot<T>):void
Parameters
result:QueryDocumentSnapshot<T>
Returnsvoid
Optional thisArg:any
The
thisbinding for the callback.
Returnsvoid
isEqual
- is
Equal(other: QuerySnapshot<T>):boolean Returns true if this
QuerySnapshotis equal to the provided one.Parameters
other:QuerySnapshot<T>
The
QuerySnapshotto compare against.
Returnsboolean
true if this
QuerySnapshotis equal to the provided one.
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 2022-07-27 UTC.