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 sealed class AggregateQuery : IEquatable<AggregateQuery>

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

A query for running server-side aggregations. Instances of this can be created using
[Count()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_Count) and [Aggregate(AggregateField, params AggregateField\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.Query#Google_Cloud_Firestore_Query_Aggregate_Google_Cloud_Firestore_AggregateField_Google_Cloud_Firestore_AggregateField___).

## Inheritance

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

## Implements

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

## Inherited Members

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

## Namespace

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

## Assembly

Google.Cloud.Firestore.dll

## Methods

### ExplainAsync(ExplainOptions, CancellationToken)

    public Task<ExplainResults<AggregateQuerySnapshot>> 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.AggregateQuerySnapshot` | 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<AggregateQuerySnapshot> GetSnapshotAsync(CancellationToken cancellationToken = default)

Asynchronously takes a snapshot of the result after applying the aggregate functions on 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.AggregateQuerySnapshot` | A [AggregateQuerySnapshot](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuerySnapshot) which contains results of the Aggregate functions. |