Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-01-19 UTC."],[],[],null,["# QuerySnapshot class\n\nA `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.\n\n**Signature:** \n\n export declare class QuerySnapshot\u003cAppModelType = DocumentData, DbModelType extends DocumentData = DocumentData\u003e \n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|---------------------------------------------------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|\n| [docs](./firestore_lite.querysnapshot.md#querysnapshotdocs) | | Array\\\u003c[QueryDocumentSnapshot](./firestore_lite.querydocumentsnapshot.md#querydocumentsnapshot_class)\\\u003cAppModelType, DbModelType\\\u003e\\\u003e | An array of all the documents in the `QuerySnapshot`. |\n| [empty](./firestore_lite.querysnapshot.md#querysnapshotempty) | | boolean | True if there are no documents in the `QuerySnapshot`. |\n| [query](./firestore_lite.querysnapshot.md#querysnapshotquery) | | [Query](./firestore_lite.query.md#query_class)\\\u003cAppModelType, DbModelType\\\u003e | The query on which you called [getDocs()](./firestore_.md#getdocs_4e56953) in order to get this `QuerySnapshot`. |\n| [size](./firestore_lite.querysnapshot.md#querysnapshotsize) | | number | The number of documents in the `QuerySnapshot`. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|--------------------------------------------------------------------------------------|-----------|---------------------------------------------------------|\n| [forEach(callback, thisArg)](./firestore_lite.querysnapshot.md#querysnapshotforeach) | | Enumerates all of the documents in the `QuerySnapshot`. |\n\nQuerySnapshot.docs\n------------------\n\nAn array of all the documents in the `QuerySnapshot`.\n\n**Signature:** \n\n get docs(): Array\u003cQueryDocumentSnapshot\u003cAppModelType, DbModelType\u003e\u003e;\n\nQuerySnapshot.empty\n-------------------\n\nTrue if there are no documents in the `QuerySnapshot`.\n\n**Signature:** \n\n get empty(): boolean;\n\nQuerySnapshot.query\n-------------------\n\nThe query on which you called [getDocs()](./firestore_.md#getdocs_4e56953) in order to get this `QuerySnapshot`.\n\n**Signature:** \n\n readonly query: Query\u003cAppModelType, DbModelType\u003e;\n\nQuerySnapshot.size\n------------------\n\nThe number of documents in the `QuerySnapshot`.\n\n**Signature:** \n\n get size(): number;\n\nQuerySnapshot.forEach()\n-----------------------\n\nEnumerates all of the documents in the `QuerySnapshot`.\n\n**Signature:** \n\n forEach(callback: (result: QueryDocumentSnapshot\u003cAppModelType, DbModelType\u003e) =\u003e void, thisArg?: unknown): void;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| callback | (result: [QueryDocumentSnapshot](./firestore_lite.querydocumentsnapshot.md#querydocumentsnapshot_class)\\\u003cAppModelType, DbModelType\\\u003e) =\\\u003e void | A callback to be called with a `QueryDocumentSnapshot` for each document in the snapshot. |\n| thisArg | unknown | The `this` binding for the callback. |\n\n**Returns:**\n\nvoid"]]