docs-devsite/firestore_lite.querysnapshot.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
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.
<b>Signature:</b>
export declare class QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData>
| Property | Modifiers | Type | Description |
|---|---|---|---|
| docs | Array<QueryDocumentSnapshot<!-- --><AppModelType, DbModelType>> | An array of all the documents in the <code>QuerySnapshot</code>. | |
| empty | boolean | True if there are no documents in the <code>QuerySnapshot</code>. | |
| query | Query<!-- --><AppModelType, DbModelType> | The query on which you called getDocs() in order to get this <code>QuerySnapshot</code>. | |
| size | number | The number of documents in the <code>QuerySnapshot</code>. |
| Method | Modifiers | Description |
|---|---|---|
| forEach(callback, thisArg) | Enumerates all of the documents in the <code>QuerySnapshot</code>. |
An array of all the documents in the QuerySnapshot<!-- -->.
<b>Signature:</b>
get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
True if there are no documents in the QuerySnapshot<!-- -->.
<b>Signature:</b>
get empty(): boolean;
The query on which you called getDocs() in order to get this QuerySnapshot<!-- -->.
<b>Signature:</b>
readonly query: Query<AppModelType, DbModelType>;
The number of documents in the QuerySnapshot<!-- -->.
<b>Signature:</b>
get size(): number;
Enumerates all of the documents in the QuerySnapshot<!-- -->.
<b>Signature:</b>
forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void;
| Parameter | Type | Description |
|---|---|---|
| callback | (result: QueryDocumentSnapshot<!-- --><AppModelType, DbModelType>) => void | A callback to be called with a <code>QueryDocumentSnapshot</code> for each document in the snapshot. |
| thisArg | unknown | The <code>this</code> binding for the callback. |
<b>Returns:</b>
void