A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with [data()] or [get()] to get a specific field.
A QueryDocumentSnapshot offers the same API surface as aDocumentSnapshot. Since query results contain only existing documents, the [exists] property will always be true and [data()] will never return 'undefined'.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class QueryDocumentSnapshot (7.11.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.11.0 (latest)](/nodejs/docs/reference/firestore/latest/firestore/querydocumentsnapshot)\n- [7.9.0](/nodejs/docs/reference/firestore/7.9.0/firestore/querydocumentsnapshot)\n- [7.7.0](/nodejs/docs/reference/firestore/7.7.0/firestore/querydocumentsnapshot)\n- [7.6.0](/nodejs/docs/reference/firestore/7.6.0/firestore/querydocumentsnapshot)\n- [7.5.0](/nodejs/docs/reference/firestore/7.5.0/firestore/querydocumentsnapshot)\n- [7.4.0](/nodejs/docs/reference/firestore/7.4.0/firestore/querydocumentsnapshot)\n- [7.3.1](/nodejs/docs/reference/firestore/7.3.1/firestore/querydocumentsnapshot)\n- [7.2.0](/nodejs/docs/reference/firestore/7.2.0/firestore/querydocumentsnapshot)\n- [7.1.0](/nodejs/docs/reference/firestore/7.1.0/firestore/querydocumentsnapshot)\n- [6.4.1](/nodejs/docs/reference/firestore/6.4.1/firestore/querydocumentsnapshot)\n- [6.3.0](/nodejs/docs/reference/firestore/6.3.0/firestore/querydocumentsnapshot)\n- [6.0.0](/nodejs/docs/reference/firestore/6.0.0/firestore/querydocumentsnapshot)\n- [5.0.2](/nodejs/docs/reference/firestore/5.0.2/firestore/querydocumentsnapshot)\n- [4.15.1](/nodejs/docs/reference/firestore/4.15.1/firestore/querydocumentsnapshot)\n- [4.14.2](/nodejs/docs/reference/firestore/4.14.2/firestore/querydocumentsnapshot)\n- [4.9.8](/nodejs/docs/reference/firestore/4.9.8/firestore/querydocumentsnapshot) \nA QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with \\[data()\\] or \\[get()\\] to get a specific field.\n\nA QueryDocumentSnapshot offers the same API surface as a [DocumentSnapshot](/nodejs/docs/reference/firestore/latest/firestore/documentsnapshot). Since query results contain only existing documents, the \\[exists\\] property will always be true and \\[data()\\] will never return 'undefined'.\n\nQueryDocumentSnapshot DocumentSnapshot \n\nInheritance\n-----------\n\n[DocumentSnapshot](/nodejs/docs/reference/firestore/latest/firestore/documentsnapshot)\\\u003cAppModelType, DbModelType\\\u003e \\\u003e QueryDocumentSnapshot\n\nPackage\n-------\n\n[@google-cloud/firestore](../overview.html)\n\nProperties\n----------\n\n### createTime\n\n /** @override */\n get createTime(): Timestamp;\n\nThe time the document was created.\n\n{Timestamp} QueryDocumentSnapshot#createTime\n**Example** \n\n\n let query = firestore.collection('col');\n\n query.get().forEach(snapshot =\u003e {\n console.log(`Document created at '${snapshot.createTime.toDate()}'`);\n });\n\n### updateTime\n\n /** @override */\n get updateTime(): Timestamp;\n\nThe time the document was last updated (at the time the snapshot was generated).\n\n{Timestamp} QueryDocumentSnapshot#updateTime\n**Example** \n\n\n let query = firestore.collection('col');\n\n query.get().forEach(snapshot =\u003e {\n console.log(`Document updated at '${snapshot.updateTime.toDate()}'`);\n });\n\nMethods\n-------\n\n### data()\n\n /** @override */\n data(): AppModelType;\n\nRetrieves all fields in the document as an object.\n\n**Example** \n\n\n let query = firestore.collection('col');\n\n query.get().forEach(documentSnapshot =\u003e {\n let data = documentSnapshot.data();\n console.log(`Retrieved data: ${JSON.stringify(data)}`);\n });"]]