| 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: 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.
| enum | Query.Direction | An enum for the direction of a sort. | |
| 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 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 |
whereEqualTo(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be equal to the specified value.
|
| Query |
whereEqualTo(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be equal to the specified value.
|
| Query |
whereGreaterThan(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be greater than the specified value.
|
| Query |
whereGreaterThan(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be greater than the specified value.
|
| Query |
whereGreaterThanOrEqualTo(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be greater than or equal to the specified value.
|
| Query |
whereGreaterThanOrEqualTo(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be greater than or equal to the specified value.
|
| Query |
whereLessThan(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be less than the specified value.
|
| Query |
whereLessThan(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be less than the specified value.
|
| Query |
whereLessThanOrEqualTo(FieldPath fieldPath, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be less than or equal to the specified value.
|
| Query |
whereLessThanOrEqualTo(String field, Object value)
Creates and returns a new Query with the additional filter that documents must contain the
specified field and the value should be less than or equal to the specified value.
|
Starts listening to this query using an Activity-scoped listener.
The listener will be automatically removed during onStop().
| activity | The activity to scope the listener to. |
|---|---|
| listener | The event listener that will be called with the snapshots. |
Starts listening to this query with the given options.
| metadataChanges | Indicates whether metadata-only changes (i.e. only Query.getMetadata() changed) should trigger snapshot events. |
|---|---|
| listener | The event listener that will be called with the snapshots. |
Starts listening to this query.
| executor | The executor to use to call the listener. |
|---|---|
| listener | The event listener that will be called with the snapshots. |
Starts listening to this query with the given options.
| executor | The executor to use to call the listener. |
|---|---|
| metadataChanges | Indicates whether metadata-only changes (i.e. only Query.getMetadata() changed) should trigger snapshot events. |
| listener | The event listener that will be called with the snapshots. |
Starts listening to this query with the given options, using an Activity-scoped listener.
The listener will be automatically removed during onStop().
| activity | The activity to scope the listener to. |
|---|---|
| metadataChanges | Indicates whether metadata-only changes (i.e. only Query.getMetadata() changed) should trigger snapshot events. |
| listener | The event listener that will be called with the snapshots. |
Starts listening to this query.
| listener | The event listener that will be called with the snapshots. |
|---|
Creates and returns a new Query that ends at the provided document (inclusive). The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query.
| snapshot | The snapshot of the document to end at. |
|---|
Creates and returns a new Query that ends at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.
| fieldValues | The field values to end this query at, in order of the query's order by. |
|---|
Creates and returns a new Query that ends before the provided document (exclusive). The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query.
| snapshot | The snapshot of the document to end before. |
|---|
Creates and returns a new Query that ends before the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.
| fieldValues | The field values to end this query before, in order of the query's order by. |
|---|
Executes the query and returns the results as a QuerySnapshot.
Executes the query and returns the results as a QuerySnapshot.
By default, get() attempts to provide up-to-date data when possible by waiting for data from
the server, but it may return cached data or fail if you are offline and the server cannot be
reached. This behavior can be altered via the Source parameter.
| source | A value to configure the get behavior. |
|---|
Creates and returns a new Query that's additionally limited to only return up to the specified number of documents.
| limit | The maximum number of items to return. |
|---|
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
| field | The field to sort by. |
|---|---|
| direction | The direction to sort. |
Creates and returns a new Query that's additionally sorted by the specified field.
| fieldPath | The field to sort by. |
|---|
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
| fieldPath | The field to sort by. |
|---|---|
| direction | The direction to sort. |
Creates and returns a new Query that's additionally sorted by the specified field.
| field | The field to sort by. |
|---|
Creates and returns a new Query that starts after the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.
| fieldValues | The field values to start this query after, in order of the query's order by. |
|---|
Creates and returns a new Query that starts after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query.
| snapshot | The snapshot of the document to start after. |
|---|
Creates and returns a new Query that starts at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.
| fieldValues | The field values to start this query at, in order of the query's order by. |
|---|
Creates and returns a new Query that starts at the provided document (inclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query.
| snapshot | The snapshot of the document to start at. |
|---|
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.
A Query can have only one whereArrayContains() filter and it cannot be combined with whereArrayContainsAny().
| fieldPath | The path of the field containing an array to search. |
|---|---|
| value | The value that must be contained in the array |
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.
A Query can have only one whereArrayContains() filter and it cannot be combined with whereArrayContainsAny().
| field | The name of the field containing an array to search. |
|---|---|
| value | The value that must be contained in the array |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than the specified value.
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value.
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be greater than or equal to the specified value.
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value.
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value.
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value.
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than or equal to the specified value.
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |