QuerySnapshot
class QuerySnapshot : Iterable
A QuerySnapshot contains the results of a query. It can contain zero or more DocumentSnapshot objects.
Subclassing Note: Cloud 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.
Summary
Public functions |
|
|---|---|
Boolean |
|
(Mutable)List<DocumentChange!> |
Returns the list of documents that changed since the last snapshot. |
(Mutable)List<DocumentChange!> |
getDocumentChanges(metadataChanges: MetadataChanges)Returns the list of documents that changed since the last snapshot. |
(Mutable)List<DocumentSnapshot!> |
Returns the documents in this |
Query |
getQuery() |
Int |
hashCode() |
Boolean |
isEmpty()Returns true if there are no documents in the |
(Mutable)Iterator<QueryDocumentSnapshot!> |
iterator() |
Int |
size()Returns the number of documents in the |
(Mutable)List<T!> |
Returns the contents of the documents in the |
(Mutable)List<T!> |
<T> toObjects(Returns the contents of the documents in the |
Public properties |
|
|---|---|
SnapshotMetadata! |
Extension functions |
|
|---|---|
inline List<T> |
<T : Any> QuerySnapshot.toObjects()Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list. |
inline List<T> |
<T : Any> QuerySnapshot.toObjects(Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list. |
Inherited functions |
||||
|---|---|---|---|---|
|
Public functions
getDocumentChanges
fun getDocumentChanges(): (Mutable)List<DocumentChange!>
Returns the list of documents that changed since the last snapshot. If it's the first snapshot all documents will be in the list as added changes.
Documents with changes only to their metadata will not be included.
| Returns | |
|---|---|
(Mutable)List<DocumentChange!> |
The list of document changes since the last snapshot. |
getDocumentChanges
fun getDocumentChanges(metadataChanges: MetadataChanges): (Mutable)List<DocumentChange!>
Returns the list of documents that changed since the last snapshot. If it's the first snapshot all documents will be in the list as added changes.
| Parameters | |
|---|---|
metadataChanges: MetadataChanges |
Indicates whether metadata-only changes (specifically, only |
| Returns | |
|---|---|
(Mutable)List<DocumentChange!> |
The list of document changes since the last snapshot. |
getDocuments
fun getDocuments(): (Mutable)List<DocumentSnapshot!>
Returns the documents in this QuerySnapshot as a List in order of the query.
| Returns | |
|---|---|
(Mutable)List<DocumentSnapshot!> |
The list of documents. |
toObjects
fun <T> toObjects(clazz: Class<T!>): (Mutable)List<T!>
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
clazz: Class<T!> |
The POJO type used to convert the documents in the list. |
toObjects
fun <T> toObjects(
clazz: Class<T!>,
serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): (Mutable)List<T!>
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
clazz: Class<T!> |
The POJO type used to convert the documents in the list. |
serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior |
Configures the behavior for server timestamps that have not yet been set to their final value. |
Public properties
Extension functions
toObjects
inline fun <T : Any> QuerySnapshot.toObjects(): List<T>
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
<T : Any> |
The POJO type used to convert the documents in the list. |
toObjects
inline fun <T : Any> QuerySnapshot.toObjects(
serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): List<T>
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
<T : Any> |
The POJO type used to convert the documents in the list. |
serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior |
Configures the behavior for server timestamps that have not yet been set to their final value. |