QuerySnapshot
public class QuerySnapshot implements 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 fields |
|
|---|---|
final SnapshotMetadata |
Public methods |
|
|---|---|
boolean |
|
@NonNull List<DocumentChange> |
Returns the list of documents that changed since the last snapshot. |
@NonNull List<DocumentChange> |
getDocumentChanges(@NonNull MetadataChanges metadataChanges)Returns the list of documents that changed since the last snapshot. |
@NonNull List<DocumentSnapshot> |
Returns the documents in this |
@NonNull SnapshotMetadata |
|
@NonNull Query |
getQuery() |
int |
hashCode() |
boolean |
isEmpty()Returns true if there are no documents in the |
@NonNull Iterator<QueryDocumentSnapshot> |
iterator() |
int |
size()Returns the number of documents in the |
@NonNull List<T> |
Returns the contents of the documents in the |
@NonNull List<T> |
<T> toObjects(Returns the contents of the documents in the |
Extension functions |
|
|---|---|
final @NonNull List<@NonNull T> |
<T extends Object> FirestoreKt.toObjects(@NonNull QuerySnapshot receiver)Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list. |
final @NonNull List<@NonNull T> |
<T extends Object> FirestoreKt.toObjects(Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list. |
Inherited methods |
||||
|---|---|---|---|---|
|
Public fields
Public methods
getDocumentChanges
public @NonNull List<DocumentChange> getDocumentChanges()
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 | |
|---|---|
@NonNull List<DocumentChange> |
The list of document changes since the last snapshot. |
getDocumentChanges
public @NonNull List<DocumentChange> getDocumentChanges(@NonNull MetadataChanges metadataChanges)
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 | |
|---|---|
@NonNull MetadataChanges metadataChanges |
Indicates whether metadata-only changes (specifically, only |
| Returns | |
|---|---|
@NonNull List<DocumentChange> |
The list of document changes since the last snapshot. |
getDocuments
public @NonNull List<DocumentSnapshot> getDocuments()
Returns the documents in this QuerySnapshot as a List in order of the query.
| Returns | |
|---|---|
@NonNull List<DocumentSnapshot> |
The list of documents. |
getMetadata
public @NonNull SnapshotMetadata getMetadata()
| Returns | |
|---|---|
@NonNull SnapshotMetadata |
The metadata for this query snapshot. |
toObjects
public @NonNull List<T> <T> toObjects(@NonNull Class<T> clazz)
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
toObjects
public @NonNull List<T> <T> toObjects(
@NonNull Class<T> clazz,
@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
@NonNull Class<T> clazz |
The POJO type used to convert the documents in the list. |
@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior |
Configures the behavior for server timestamps that have not yet been set to their final value. |
Extension functions
FirestoreKt.toObjects
public final @NonNull List<@NonNull T> <T extends Object> FirestoreKt.toObjects(@NonNull QuerySnapshot receiver)
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
<T extends Object> |
The POJO type used to convert the documents in the list. |
FirestoreKt.toObjects
public final @NonNull List<@NonNull T> <T extends Object> FirestoreKt.toObjects(
@NonNull QuerySnapshot receiver,
@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Parameters | |
|---|---|
<T extends Object> |
The POJO type used to convert the documents in the list. |
@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior |
Configures the behavior for server timestamps that have not yet been set to their final value. |