Package com.google.cloud.firestore
Class QueryDocumentSnapshot
java.lang.Object
com.google.cloud.firestore.DocumentSnapshot
com.google.cloud.firestore.QueryDocumentSnapshot
A QueryDocumentSnapshot contains data read from a document in a Firestore database as part of a
query. The document is guaranteed to exist and its data can be extracted using the
getData()
or DocumentSnapshot.get(String)
methods.
QueryDocumentSnapshot offers the same API surface as DocumentSnapshot
. Since query
results contain only existing documents, the DocumentSnapshot.exists()
method will always return true and
getData()
will never be null.
Subclassing Note: Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.
-
Method Summary
Methods inherited from class com.google.cloud.firestore.DocumentSnapshot
contains, contains, equals, exists, get, get, get, get, getBlob, getBoolean, getCreateTime, getDate, getDouble, getGeoPoint, getId, getLong, getReadTime, getReference, getString, getTimestamp, getUpdateTime, hashCode, toString
-
Method Details
-
getData
Returns the fields of the document as a Map. Field values will be converted to their native Java representation.- Overrides:
getData
in classDocumentSnapshot
- Returns:
- The fields of the document as a Map.
-
toObject
Returns the contents of the document converted to a POJO.- Overrides:
toObject
in classDocumentSnapshot
- Parameters:
valueType
- The Java class to create- Returns:
- The contents of the document in an object of type T
-