Details | |
---|---|
Returns | An aggregate query that counts the documents in the result set of this query. |
QueryEndAt(DocumentSnapshotsnapshot)
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 order-by clauses of the query.
This call replaces any previously specified end position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified end position. |
QueryEndAt(paramsobject[]fieldValues)
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.
This call replaces any previously specified end position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified end position. |
QueryEndBefore(DocumentSnapshotsnapshot)
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 order-by clauses of the query.
This call replaces any previously specified end position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified end position. |
QueryEndBefore(paramsobject[]fieldValues)
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.
This call replaces any previously specified end position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified end position. |
overrideboolEquals(objectobj)
boolEquals(Queryother)
overrideintGetHashCode()
Task<QuerySnapshot>GetSnapshotAsync(Sourcesource)
Asynchronously executes the query and returns all matching documents as a QuerySnapshot
.
By default, GetSnapshotAsync
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.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A snapshot of documents matching the query. |
QueryLimit(intlimit)
Creates and returns a new Query
that only returns the last matching documents up to the specified number.
This call replaces any previously-specified limit in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified limit applied. |
QueryLimitToLast(intlimit)
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.
This call replaces any previously-specified limit in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified limit applied. |
ListenerRegistrationListen(Action<QuerySnapshot>callback)
Starts listening to changes to the query results described by this Query
.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A ListenerRegistration which may be used to stop listening gracefully. |
ListenerRegistrationListen(MetadataChangesmetadataChanges,Action<QuerySnapshot>callback)
Starts listening to changes to the query results described by this Query
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A ListenerRegistration which may be used to stop listening gracefully. |
QueryOrderBy(stringfieldPath)
Creates and returns a new Query
that's additionally sorted by the specified field.
Unlike OrderBy in LINQ, this call makes each additional ordering subordinate to the preceding ones. This means that query.OrderBy("foo").OrderBy("bar")
in Cloud Firestore is similar to query.OrderBy(x => x.Foo).ThenBy(x => x.Bar)
in LINQ.
This method cannot be called after a start/end cursor has been specified with StartAt(DocumentSnapshot), StartAfter(DocumentSnapshot), EndAt(DocumentSnapshot) or EndBefore(DocumentSnapshot) or other overloads.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the additional specified ordering applied. |
QueryOrderBy(FieldPathfieldPath)
Creates and returns a new Query
that's additionally sorted by the specified field.
Unlike OrderBy in LINQ, this call makes each additional ordering subordinate to the preceding ones. This means that query.OrderBy("foo").OrderBy("bar")
in Cloud Firestore is similar to query.OrderBy(x => x.Foo).ThenBy(x => x.Bar)
in LINQ.
This method cannot be called after a start/end cursor has been specified with StartAt(DocumentSnapshot), StartAfter(DocumentSnapshot), EndAt(DocumentSnapshot) or EndBefore(DocumentSnapshot) or other overloads.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the additional specified ordering applied. |
QueryOrderByDescending(stringfieldPath)
Creates and returns a new Query
that's additionally sorted by the specified field in descending order.
Unlike OrderByDescending in LINQ, this call makes each additional ordering subordinate to the preceding ones. This means that query.OrderByDescending("foo").OrderByDescending("bar")
in Cloud Firestore is similar to query.OrderByDescending(x => x.Foo).ThenByDescending(x => x.Bar)
in LINQ.
This method cannot be called after a start/end cursor has been specified with StartAt(DocumentSnapshot), StartAfter(DocumentSnapshot), EndAt(DocumentSnapshot) or EndBefore(DocumentSnapshot) or other overloads.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the additional specified ordering applied. |
QueryOrderByDescending(FieldPathfieldPath)
Creates and returns a new Query
that's additionally sorted by the specified field in descending order.
Unlike OrderByDescending in LINQ, this call makes each additional ordering subordinate to the preceding ones. This means that query.OrderByDescending("foo").OrderByDescending("bar")
in Cloud Firestore is similar to query.OrderByDescending(x => x.Foo).ThenByDescending(x => x.Bar)
in LINQ.
This method cannot be called after a start/end cursor has been specified with StartAt(DocumentSnapshot), StartAfter(DocumentSnapshot), EndAt(DocumentSnapshot) or EndBefore(DocumentSnapshot) or other overloads.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the additional specified ordering applied. |
QueryStartAfter(DocumentSnapshotsnapshot)
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 order-by clauses of the query.
This call replaces any previously specified start position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified start position. |
QueryStartAfter(paramsobject[]fieldValues)
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.
This call replaces any previously specified start position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified start position. |
QueryStartAt(DocumentSnapshotsnapshot)
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 order-by clauses of the query.
This call replaces any previously specified start position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified start position. |
QueryStartAt(paramsobject[]fieldValues)
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.
This call replaces any previously specified start position in the query.
Details | |||
---|---|---|---|
Parameters |
| ||
Returns | A new query based on the current one, but with the specified start position. |
QueryWhereArrayContains(FieldPathfieldPath,objectvalue)
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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereArrayContains(stringfieldPath,objectvalue)
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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereArrayContainsAny(FieldPathfieldPath,IEnumerable<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.
A Query
can have only one WhereArrayContainsAny()
filter and it cannot be combined with WhereArrayContains()
or WhereIn()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereArrayContainsAny(stringfieldPath,IEnumerable<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.
A Query
can have only one WhereArrayContainsAny()
filter and it cannot be combined with WhereArrayContains()
or WhereIn()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereEqualTo(stringfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereEqualTo(FieldPathfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereGreaterThan(stringfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereGreaterThan(FieldPathfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereGreaterThanOrEqualTo(stringfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereGreaterThanOrEqualTo(FieldPathfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereIn(FieldPathfieldPath,IEnumerable<object>values)
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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereIn(stringfieldPath,IEnumerable<object>values)
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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereLessThan(stringfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereLessThan(FieldPathfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereLessThanOrEqualTo(stringfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereLessThanOrEqualTo(FieldPathfieldPath,objectvalue)
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.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereNotEqualTo(stringfieldPath,objectvalue)
Creates and returns a new Query
with the additional filter that documents must contain the specified field and the value should not equal the specified value.
A Query can have only one WhereNotEqualTo()
filter, and it cannot be combined with WhereNotIn()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereNotEqualTo(FieldPathfieldPath,objectvalue)
Creates and returns a new Query
with the additional filter that documents must contain the specified field and the value should not equal the specified value.
A Query can have only one WhereNotEqualTo()
filter, and it cannot be combined with WhereNotIn()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereNotIn(FieldPathfieldPath,IEnumerable<object>values)
Creates and returns a new Query
with the additional filter that documents must contain the specified field and the value must not equal any value 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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
QueryWhereNotIn(stringfieldPath,IEnumerable<object>values)
Creates and returns a new Query
with the additional filter that documents must contain the specified field and the value must not equal any value 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()
.
Details | |||||
---|---|---|---|---|---|
Parameters |
| ||||
Returns | A new query based on the current one, but with the additional filter applied. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-13 UTC.