QueryDocumentSnapshot class Stay organized with collections Save and categorize content based on your preferences.
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
| Method | Modifiers | Description |
|---|---|---|
| data() | Retrieves all fields in the document as anObject. |
QueryDocumentSnapshot.data()
Retrieves all fields in the document as anObject.
Signature:
/** @override */data():AppModelType;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.