public class Query extends Object
Known Direct Subclasses |
A Query
which you can read or listen to. You can also construct refined
Query
objects by adding filters and ordering.
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.
Nested Class Summary
enum | Query.Direction | An enum for the direction of a sort. |
Public Method Summary
ListenerRegistration |
addSnapshotListener(Activity
activity, EventListener<QuerySnapshot>
listener)
Starts listening to this query using an Activity-scoped listener.
|
ListenerRegistration |
addSnapshotListener(MetadataChanges
metadataChanges, EventListener<QuerySnapshot>
listener)
Starts listening to this query with the given options.
|
ListenerRegistration |
addSnapshotListener(Executor
executor, EventListener<QuerySnapshot>
listener)
Starts listening to this query.
|
ListenerRegistration |
addSnapshotListener(Executor
executor, MetadataChanges
metadataChanges, EventListener<QuerySnapshot>
listener)
Starts listening to this query with the given options.
|
ListenerRegistration |
addSnapshotListener(Activity
activity, MetadataChanges
metadataChanges, EventListener<QuerySnapshot>
listener)
Starts listening to this query with the given options, using an Activity-scoped
listener.
|
ListenerRegistration | |
Query |
endAt(DocumentSnapshot
snapshot)
Creates and returns a new
Query that ends at the provided document
(inclusive).
|
Query | |
Query |
endBefore(DocumentSnapshot
snapshot)
Creates and returns a new
Query that ends before the provided
document (exclusive).
|
Query | |
boolean | |
Task<QuerySnapshot> |
get()
Executes the query and returns the results as a
QuerySnapshot .
|
Task<QuerySnapshot> | |
FirebaseFirestore |
getFirestore()
Gets the Cloud Firestore instance associated with this query.
|
int |
hashCode()
|
Query |
limit(long
limit)
Creates and returns a new
Query that's additionally limited to
only return up to the specified number of documents.
|
Query |
orderBy(String field,
Query.Direction
direction)
Creates and returns a new
Query that's additionally sorted by the
specified field, optionally in descending order instead of ascending.
|
Query | |
Query |
orderBy(FieldPath
fieldPath, Query.Direction
direction)
Creates and returns a new
Query that's additionally sorted by the
specified field, optionally in descending order instead of ascending.
|
Query | |
Query |
startAfter(Object...
fieldValues)
Creates and returns a new
Query that starts after the provided
fields relative to the order of the query.
|
Query |
startAfter(DocumentSnapshot
snapshot)
Creates and returns a new
Query that starts after the provided
document (exclusive).
|
Query | |
Query |
startAt(DocumentSnapshot
snapshot)
Creates and returns a new
Query that starts at the provided
document (inclusive).
|
Query |
whereArrayContains(FieldPath
fieldPath, Object value)
Creates and returns a new
Query with the additional filter that
documents must contain the specified field, the value must be an array, and
that the array must contain the provided value.
|
Query |
whereArrayContains(String field,
Object
value)
Creates and returns a new
Query with the additional filter that
documents must contain the specified field, the value must be an array, and
that the array must contain the provided value.
|
Query |