QueryDocumentSnapshot class

AQueryDocumentSnapshot 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(<field>) to get a specific field.

AQueryDocumentSnapshot offers the same API surface as aDocumentSnapshot. Since query results contain only existing documents, theexists property will always be true anddata() will never return 'undefined'.

Signature:

exportdeclareclassQueryDocumentSnapshot<AppModelType=DocumentData,DbModelTypeextendsDocumentData=DocumentData>extendsDocumentSnapshot<AppModelType,DbModelType>

Extends:DocumentSnapshot<AppModelType, DbModelType>

Methods

MethodModifiersDescription
data(options)Retrieves all fields in the document as anObject.By default,serverTimestamp() values that have not yet been set to their final value will be returned asnull. You can override this by passing an options object.

QueryDocumentSnapshot.data()

Retrieves all fields in the document as anObject.

By default,serverTimestamp() values that have not yet been set to their final value will be returned asnull. You can override this by passing an options object.

Signature:

/** @override */data(options?:SnapshotOptions):AppModelType;

Parameters

ParameterTypeDescription
optionsSnapshotOptionsAn options object to configure how data is retrieved from the snapshot (for example the desired behavior for server timestamps that have not yet been set to their final value).

Returns:

AppModelType

AnObject containing all fields in the document.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-15 UTC.