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 the
data property or by using subscript syntax to access a specific field.
A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. As
deleted documents are not returned from queries, its exists property will always be true and
data() will never return nil.
Retrieves all fields in the document as a Dictionary.
Server-provided timestamps that have not yet been set to their final value will be returned as
NSNull. You can use the data(with:) method to configure this behavior.
Declaration
Swift
funcdata()->[String:Any]
Return Value
A Dictionary containing all fields in the document.
[[["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 2025-03-11 UTC."],[],[],null,["# FirebaseFirestore Framework Reference\n\nQueryDocumentSnapshot\n=====================\n\n class QueryDocumentSnapshot : ../Classes/DocumentSnapshot.html\n\nA `QueryDocumentSnapshot` contains data read from a document in your Firestore database as\npart of a query. The document is guaranteed to exist and its data can be extracted with the\n`data` property or by using subscript syntax to access a specific field.\n\nA `QueryDocumentSnapshot` offers the same API surface as a [DocumentSnapshot](../Classes/DocumentSnapshot.html). As\ndeleted documents are not returned from queries, its `exists` property will always be true and\n`data()` will never return `nil`.\n- `\n ``\n ``\n `\n\n ### [data()](#/c:objc(cs)FIRQueryDocumentSnapshot(im)data)\n\n `\n ` \n Retrieves all fields in the document as a `Dictionary`.\n\n Server-provided timestamps that have not yet been set to their final value will be returned as\n `NSNull`. You can use the [data(with:)](../Classes/QueryDocumentSnapshot.html#/c:objc(cs)FIRQueryDocumentSnapshot(im)dataWithServerTimestampBehavior:) method to configure this behavior. \n\n #### Declaration\n\n Swift \n\n func data() -\u003e [String : Any]\n\n #### Return Value\n\n A `Dictionary` containing all fields in the document.\n- `\n ``\n ``\n `\n\n ### [data(with:)](#/c:objc(cs)FIRQueryDocumentSnapshot(im)dataWithServerTimestampBehavior:)\n\n `\n ` \n Retrieves all fields in the document as a `Dictionary`. \n\n #### Declaration\n\n Swift \n\n func data(with serverTimestampBehavior: ../Enums/ServerTimestampBehavior.html) -\u003e [String : Any]\n\n #### Parameters\n\n |---------------------------------|------------------------------------------------------------------------------------------------------------------|\n | ` `*serverTimestampBehavior*` ` | Configures how server timestamps that have not yet been set to their final value are returned from the snapshot. |\n\n #### Return Value\n\n A `Dictionary` containing all fields in the document."]]