Home > @firebase/firestore > / > QuerySnapshot
QuerySnapshot class
A QuerySnapshot contains zero or more DocumentSnapshot 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.
Signature:
export declare class QuerySnapshot<T = DocumentData>
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| docs | Array<QueryDocumentSnapshot<T>> | An array of all the documents in the QuerySnapshot. |
|
| empty | boolean | True if there are no documents in the QuerySnapshot. |
|
| metadata | SnapshotMetadata | Metadata about this snapshot, concerning its source and if it has local modifications. | |
| query | Query<T> | The query on which you called get or onSnapshot in order to get this QuerySnapshot. |
|
| size | number | The number of documents in the QuerySnapshot. |
Methods
| Method | Modifiers | Description |
|---|---|---|
| docChanges(options) | 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. | |
| forEach(callback, thisArg) | Enumerates all of the documents in the QuerySnapshot. |