| 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.
| 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 Cloud Firestore instance associated with this query.
|
| int |
hashCode()
|
| Query |
limit(long limit)
Creates and returns a new
Query that only returns the first matching documents up to
the specified number. |
| Query |
limitToLast(long limit)
Creates and returns a new
Query that only returns the last matching documents up to the
specified number. |
| 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 |
whereArrayContainsAny(FieldPath fieldPath, List<? extends Object> values)
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 at least one
value from the provided list. |
| Query |
whereArrayContainsAny(String field, List<? extends Object> values)
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 at least one
value from the provided list. |
| 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 | |
| Query | |
| 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. |
| Query |
whereNotEqualTo(FieldPath fieldPath, Object value)
Creates and returns a new
Query with the additional filter that documents must contain
the specified field and the value does not equal the specified value. |
| Query |
whereNotEqualTo(String field, Object value)
Creates and returns a new
Query with the additional filter that documents must contain
the specified field and the value does not equal the specified value. |
| Query |
whereNotIn(String field, List<? extends Object> values)
Creates and returns a new
Query with the additional filter that documents must contain
the specified field and the value does not equal any of the values from the provided list. |
| Query |
whereNotIn(FieldPath fieldPath, List<? extends Object> values)
Creates and returns a new
Query with the additional filter that documents must contain
the specified field and the value does not equal any of the values from the provided list. |
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 QuerySnapshot.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 QuerySnapshot.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 QuerySnapshot.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. |
|---|
Query.
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. |
|---|
Query.
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. |
|---|
Query.
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. |
|---|
Query.
Executes the query and returns the results as a QuerySnapshot.
Query.
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. |
|---|
Query.
Gets the Cloud Firestore instance associated with this query.
Creates and returns a new Query that only returns the first matching documents up to
the specified number.
| limit | The maximum number of items to return. |
|---|
Query.
Creates and returns a new Query that only returns the last matching documents up to the
specified number.
You must specify at least one orderBy clause for limitToLast queries,
otherwise an exception will be thrown during execution.
| limit | The maximum number of items to return. |
|---|
Query.
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. |
Query.
Creates and returns a new Query that's additionally sorted by the specified field.
| fieldPath | The field to sort by. |
|---|
Query.
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. |
Query.
Creates and returns a new Query that's additionally sorted by the specified field.
| field | The field to sort by. |
|---|
Query.
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. |
|---|
Query.
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. |
|---|
Query.
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. |
|---|
Query.
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. |
|---|
Query.
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 |
Query.
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 |
Query.
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 at least one
value from the provided list.
A Query can have only one whereArrayContainsAny() filter and it cannot be
combined with whereArrayContains() or whereIn().
| fieldPath | The path of the field containing an array to search. |
|---|---|
| values | The list that contains the values to match. |
Query.
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 at least one
value from the provided list.
A Query can have only one whereArrayContainsAny() filter and it cannot be
combined with whereArrayContains() or whereIn().
| field | The name of the field containing an array to search. |
|---|---|
| values | The list that contains the values to match. |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value must equal one of the values from the provided list.
A Query can have only one whereIn() filter, and it cannot be combined with
whereArrayContainsAny().
| fieldPath | The path of the field to search. |
|---|---|
| values | The list that contains the values to match. |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value must equal one of the values from the provided list.
A Query can have only one whereIn() filter, and it cannot be combined with
whereArrayContainsAny().
| field | The name of the field to search. |
|---|---|
| values | The list that contains the values to match. |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
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 |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value does not equal the specified value.
A Query can have only one whereNotEqualTo() filter, and it cannot be
combined with whereNotIn().
| fieldPath | The path of the field to compare |
|---|---|
| value | The value for comparison |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value does not equal the specified value.
A Query can have only one whereNotEqualTo() filter, and it cannot be
combined with whereNotIn().
| field | The name of the field to compare |
|---|---|
| value | The value for comparison |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value does not equal any of the values from the provided list.
One special case is that whereNotIn cannot match null values. To query for
documents where a field exists and is null, use whereNotEqualTo, which can
handle this special case.
A Query can have only one whereNotIn() filter, and it cannot be combined
with whereArrayContains(), whereArrayContainsAny(), whereIn(), or
whereNotEqualTo().
| field | The name of the field to search. |
|---|---|
| values | The list that contains the values to match. |
Query.
Creates and returns a new Query with the additional filter that documents must contain
the specified field and the value does not equal any of the values from the provided list.
One special case is that whereNotIn cannot match null values. To query for
documents where a field exists and is null, use whereNotEqualTo, which can
handle this special case.
A Query can have only one whereNotIn() filter, and it cannot be combined
with whereArrayContains(), whereArrayContainsAny(), whereIn(), or
whereNotEqualTo().
| fieldPath | The path of the field to search. |
|---|---|
| values | The list that contains the values to match. |
Query.