4.6.0 (latest) 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.1 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.5.0 2.4.0 2.3.1

    public class Query : IEquatable<Query>

Reference documentation and code samples for the Firestore API class Query.

A query against a collection.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Query

## Implements

[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Query](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query)

## Inherited Members

[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[CollectionReference](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.CollectionReference)

## Namespace

[Google.Cloud.Firestore](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)

## Assembly

Google.Cloud.Firestore.dll

## Remarks

[CollectionReference](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.CollectionReference) derives from this class as a "return-all" query against the
collection it refers to.

## Properties

### Database

    public virtual FirestoreDb Database { get; }

The database this query will search over.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreDb` |   |

## Methods

### Aggregate(AggregateField, params AggregateField\[\])

    public AggregateQuery Aggregate(AggregateField aggregateField, params AggregateField[] aggregateFields)

Calculates the specified aggregations to return the aggregate query. Multiple aggregations can be performed in a single query.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `aggregateField` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField` Specifies the [AggregateField](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField) to be calculated. Must not be null. |
| `aggregateFields` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField` Additional aggregations to be included in the query, if any. Must not be null, but may be empty. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery` | Returns an [AggregateQuery](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery) that performs aggregations on the documents in the result set of this query. |

### Aggregate(IEnumerable\<AggregateField\>)

    public AggregateQuery Aggregate(IEnumerable<AggregateField> aggregateFields)

Calculates the specified aggregations to return the aggregate query. Multiple aggregations can be performed in a single query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `aggregateFields` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField` Aggregations to be included in the query. Must not be null, or empty. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery` | Returns an [AggregateQuery](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery) that performs aggregations on the documents in the result set of this query. |

### Count()

    public AggregateQuery Count()

Returns an [AggregateQuery](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery) with count(\*) aggregation applied on this query.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery` | An instance of [AggregateQuery](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery) with count(\*) aggregation applied. |

### EndAt(DocumentSnapshot)

    public Query EndAt(DocumentSnapshot snapshot)

Creates and returns a new query that ends at the document snapshot provided fields relative to the order of the
query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `snapshot` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot` The snapshot of the document to end at. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified end position. |

**Remarks** This call replaces any previously specified end position in the query.

### EndAt(params object\[\])

    public Query EndAt(params object[] 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldValues` | `https://learn.microsoft.com/dotnet/api/system.object` The field values. Must not be null or empty, or have more values than query has orderings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified end position. |

**Remarks** This call replaces any previously specified end position in the query.

### EndBefore(DocumentSnapshot)

    public Query EndBefore(DocumentSnapshot snapshot)

Creates and returns a new query that ends before the document snapshot provided fields relative to the order of the
query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `snapshot` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot` The snapshot of the document to end before. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified end position. |

**Remarks** This call replaces any previously specified end position in the query.

### EndBefore(params object\[\])

    public Query EndBefore(params object[] 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldValues` | `https://learn.microsoft.com/dotnet/api/system.object` The field values. Must not be null or empty, or have more values than query has orderings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified end position. |

**Remarks** This call replaces any previously specified end position in the query.

### ExplainAsync(ExplainOptions, CancellationToken)

    public Task<ExplainResults<QuerySnapshot>> ExplainAsync(ExplainOptions options, CancellationToken cancellationToken = default)

Returns an explanation for this query, optionally executing it.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.ExplainOptions` The [ExplainOptions](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.ExplainOptions) to use. Must not be null. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A cancellation token for the operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.ExplainResults-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.QuerySnapshot` | A Google.Cloud.Firestore.V1.PlanSummary for this query. |

### GetHashCode()

    public override int GetHashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### GetSnapshotAsync(CancellationToken)

    public Task<QuerySnapshot> GetSnapshotAsync(CancellationToken cancellationToken = default)

Asynchronously takes a snapshot of all documents matching the query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A cancellation token for the operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.QuerySnapshot` | A snapshot of documents matching the query. |

### Limit(int)

    public Query Limit(int limit)

Specifies the maximum number of results to return.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `limit` | `https://learn.microsoft.com/dotnet/api/system.int32` The maximum number of results to return. Must be greater than or equal to 0. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified limit applied. |

**Remarks** This call replaces any previously-specified limit in the query.

### LimitToLast(int)

    public Query LimitToLast(int limit)

Creates and returns a new query that only returns the last `limit` matching documents.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `limit` | `https://learn.microsoft.com/dotnet/api/system.int32` The maximum number of results to return. Must be greater than or equal to 0. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified limit applied. |

**Remarks**
You must specify at least one [OrderBy(string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_OrderBy_System_String_) clause for limit-to-last queries. Otherwise,
an [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) is thrown during execution.


Results for limit-to-last queries are only available once all documents are received, which means
that these queries cannot be streamed using the [StreamAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StreamAsync_System_Threading_CancellationToken_) method.

### Listen(Action\<QuerySnapshot\>, CancellationToken)

    public FirestoreChangeListener Listen(Action<QuerySnapshot> callback, CancellationToken cancellationToken = default)

Listen to this query for changes. This method is a convenience method over [Listen(Func\<QuerySnapshot, CancellationToken, Task\>, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_Listen_System_Func_Google_Cloud_Firestore_QuerySnapshot_System_Threading_CancellationToken_System_Threading_Tasks_Task__System_Threading_CancellationToken_),
wrapping a synchronous callback to create an asynchronous one.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callback` | `https://learn.microsoft.com/dotnet/api/system.action-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.QuerySnapshot` The callback to invoke each time the query results change. Must not be null. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` Optional cancellation token which may be used to cancel the listening operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreChangeListener` | A [FirestoreChangeListener](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreChangeListener) which may be used to monitor the listening operation and stop it gracefully. |

### Listen(Func\<QuerySnapshot, CancellationToken, Task\>, CancellationToken)

    public FirestoreChangeListener Listen(Func<QuerySnapshot, CancellationToken, Task> callback, CancellationToken cancellationToken = default)

Listen to this query for changes.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callback` | `https://learn.microsoft.com/dotnet/api/system.func-3https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.QuerySnapshothttps://learn.microsoft.com/dotnet/api/system.threading.cancellationtokenhttps://learn.microsoft.com/dotnet/api/system.threading.tasks.task` The callback to invoke each time the query results change. Must not be null. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` Optional cancellation token which may be used to cancel the listening operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreChangeListener` | A [FirestoreChangeListener](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreChangeListener) which may be used to monitor the listening operation and stop it gracefully. |

### Offset(int)

    public Query Offset(int offset)

Specifies a number of results to skip.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `offset` | `https://learn.microsoft.com/dotnet/api/system.int32` The number of results to skip. Must be greater than or equal to 0. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified offset applied. |

**Remarks** This call replaces any previously-specified offset in the query.

### OrderBy(FieldPath)

    public Query OrderBy(FieldPath fieldPath)

Adds an additional ascending ordering by the specified path.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to order by. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified ordering applied. |

**Remarks**
Unlike LINQ's OrderBy method, this call adds additional subordinate orderings to any
additionally specified. So `query.OrderBy("foo").OrderBy("bar")` is similar
to a LINQ `query.OrderBy(x => x.Foo).ThenBy(x => x.Bar)`.


This method cannot be called after a start/end cursor has been specified with
[StartAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAt_System_Object___), [StartAfter(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAfter_System_Object___), [EndAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndAt_System_Object___) or [EndBefore(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndBefore_System_Object___).

### OrderBy(string)

    public Query OrderBy(string fieldPath)

Adds an additional ascending ordering by the specified path.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to order by. Must not be null or empty. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified ordering applied. |

**Remarks**
Unlike LINQ's OrderBy method, this call adds additional subordinate orderings to any
additionally specified. So `query.OrderBy("foo").OrderBy("bar")` is similar
to a LINQ `query.OrderBy(x => x.Foo).ThenBy(x => x.Bar)`.


This method cannot be called after a start/end cursor has been specified with
[StartAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAt_System_Object___), [StartAfter(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAfter_System_Object___), [EndAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndAt_System_Object___) or [EndBefore(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndBefore_System_Object___).

### OrderByDescending(FieldPath)

    public Query OrderByDescending(FieldPath fieldPath)

Adds an additional descending ordering by the specified path.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to order by. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified ordering applied. |

**Remarks**
Unlike LINQ's OrderBy method, this call adds additional subordinate orderings to any
additionally specified. So `query.OrderBy("foo").OrderByDescending("bar")` is similar
to a LINQ `query.OrderBy(x => x.Foo).ThenByDescending(x => x.Bar)`.


This method cannot be called after a start/end cursor has been specified with
[StartAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAt_System_Object___), [StartAfter(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAfter_System_Object___), [EndAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndAt_System_Object___) or [EndBefore(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndBefore_System_Object___).

### OrderByDescending(string)

    public Query OrderByDescending(string fieldPath)

Adds an additional descending ordering by the specified path.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to order by. Must not be null or empty. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified ordering applied. |

**Remarks**
Unlike LINQ's OrderBy method, this call adds additional subordinate orderings to any
additionally specified. So `query.OrderBy("foo").OrderByDescending("bar")` is similar
to a LINQ `query.OrderBy(x => x.Foo).ThenByDescending(x => x.Bar)`.


This method cannot be called after a start/end cursor has been specified with
[StartAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAt_System_Object___), [StartAfter(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_StartAfter_System_Object___), [EndAt(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndAt_System_Object___) or [EndBefore(params object\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_EndBefore_System_Object___).

### Select(params FieldPath\[\])

    public Query Select(params FieldPath[] fieldPaths)

Specifies the field paths to return in the results.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPaths` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field paths to select. Must not be null or contain null elements. If this is empty, the document ID is implicitly selected. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified projection applied. |

**Remarks** This call replaces any previously-specified projections in the query.

### Select(params string\[\])

    public Query Select(params string[] fieldPaths)

Specifies the field paths to return in the results.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldPaths` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field paths to select. Must not be null or empty, or contain null or empty elements. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified projection applied. |

**Remarks** This call replaces any previously-specified projections in the query.

### StartAfter(DocumentSnapshot)

    public Query StartAfter(DocumentSnapshot snapshot)

Creates and returns a new query that starts after the document snapshot provided fields relative to the order of the
query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `snapshot` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot` The snapshot of the document to start after. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified start position. |

**Remarks** This call replaces any previously specified start position in the query.

### StartAfter(params object\[\])

    public Query StartAfter(params object[] 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldValues` | `https://learn.microsoft.com/dotnet/api/system.object` The field values. Must not be null or empty, or have more values than query has orderings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified start position. |

**Remarks** This call replaces any previously specified start position in the query.

### StartAt(DocumentSnapshot)

    public Query StartAt(DocumentSnapshot snapshot)

Creates and returns a new query that starts at the document snapshot provided fields relative to the order of the
query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `snapshot` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot` The snapshot of the document to start at. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified start position. |

**Remarks** This call replaces any previously specified start position in the query.

### StartAt(params object\[\])

    public Query StartAt(params object[] 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `fieldValues` | `https://learn.microsoft.com/dotnet/api/system.object` The field values. Must not be null or empty, or have more values than query has orderings. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the specified start position. |

**Remarks** This call replaces any previously specified start position in the query.

### StreamAsync(CancellationToken)

    public IAsyncEnumerable<DocumentSnapshot> StreamAsync(CancellationToken cancellationToken = default)

Returns an asynchronous sequence of snapshots matching the query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The cancellation token to apply to the streaming operation. Note that even if this is [None](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none), a cancellation token can still be applied when iterating over the stream, by passing it into [GetAsyncEnumerator(CancellationToken)](https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1.getasyncenumerator). If a cancellation token is passed both to this method and GetAsyncEnumerator, then cancelling either of the tokens will result in the operation being cancelled. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.DocumentSnapshot` | An asynchronous sequence of document snapshots matching the query. |

**Remarks** Each time you iterate over the sequence, a new query will be performed.

### Where(Filter)

    public Query Where(Filter filter)

Add the given filter to this query.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `filter` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Filter` filter to be applied on query, must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereArrayContains(FieldPath, object)

    public Query WhereArrayContains(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be an array containing
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to check in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereArrayContains(string, object)

    public Query WhereArrayContains(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be an array containing
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to check in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereArrayContainsAny(FieldPath, IEnumerable)

    public Query WhereArrayContainsAny(FieldPath fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is an array containing at least one value in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereArrayContainsAny(string, IEnumerable)

    public Query WhereArrayContainsAny(string fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is an array containing at least one value in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereEqualTo(FieldPath, object)

    public Query WhereEqualTo(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereEqualTo(string, object)

    public Query WhereEqualTo(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereGreaterThan(FieldPath, object)

    public Query WhereGreaterThan(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be greater than
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereGreaterThan(string, object)

    public Query WhereGreaterThan(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be greater than
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereGreaterThanOrEqualTo(FieldPath, object)

    public Query WhereGreaterThanOrEqualTo(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be greater than or
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereGreaterThanOrEqualTo(string, object)

    public Query WhereGreaterThanOrEqualTo(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be greater than or
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereIn(FieldPath, IEnumerable)

    public Query WhereIn(FieldPath fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is one of the values in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereIn(string, IEnumerable)

    public Query WhereIn(string fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is one of the values in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereLessThan(FieldPath, object)

    public Query WhereLessThan(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be less than
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereLessThan(string, object)

    public Query WhereLessThan(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be less than
`value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereLessThanOrEqualTo(FieldPath, object)

    public Query WhereLessThanOrEqualTo(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be less than or
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereLessThanOrEqualTo(string, object)

    public Query WhereLessThanOrEqualTo(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must be less than or
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereNotEqualTo(FieldPath, object)

    public Query WhereNotEqualTo(FieldPath fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must not be
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereNotEqualTo(string, object)

    public Query WhereNotEqualTo(string fieldPath, object value)

Returns a query with a filter specifying that the value in `fieldPath` must not be
equal to `value`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `value` | `https://learn.microsoft.com/dotnet/api/system.object` The value to compare in the filter. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereNotIn(FieldPath, IEnumerable)

    public Query WhereNotIn(FieldPath fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is not one of the values in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FieldPath` The field path to filter on. Must not be null. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.

### WhereNotIn(string, IEnumerable)

    public Query WhereNotIn(string fieldPath, IEnumerable values)

Returns a query with a filter specifying that `fieldPath` must be
a field present in the document, with a value which is not one of the values in `values`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldPath` | `https://learn.microsoft.com/dotnet/api/system.string` The dot-separated field path to filter on. Must not be null or empty. |
| `values` | `https://learn.microsoft.com/dotnet/api/system.collections.ienumerable` The values to compare in the filter. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query` | A new query based on the current one, but with the additional specified filter applied. |

**Remarks** This call adds additional filters to any previously-specified ones.