It uses the server side aggregation Google.Cloud.Firestore.V1.StructuredAggregationQuery.Types.Aggregation.Avg representing a server-side average aggregation function.
Creates an AggregateField representing a server-side count aggregation function.
The COUNT(*) aggregation function operates on the entire document so it does not require a field reference.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eAggregateField\u003c/code\u003e class is used to define aggregations within an \u003ccode\u003eAggregateQuery\u003c/code\u003e in the Firestore API.\u003c/p\u003e\n"],["\u003cp\u003eThe class is available in the \u003ccode\u003eGoogle.Cloud.Firestore\u003c/code\u003e namespace and has a current latest version of 3.10.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAggregateField\u003c/code\u003e supports server-side aggregations such as \u003ccode\u003eAverage\u003c/code\u003e, \u003ccode\u003eCount\u003c/code\u003e, and \u003ccode\u003eSum\u003c/code\u003e, each of which can be applied to a specific field or the entire document.\u003c/p\u003e\n"],["\u003cp\u003eEach aggregate field can have an optional alias for identifying the aggregation result in the \u003ccode\u003eAggregateQuerySnapshot\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAggregateField\u003c/code\u003e class implements \u003ccode\u003eIEquatable\u003c/code\u003e and inherits from \u003ccode\u003eobject\u003c/code\u003e, providing basic methods like \u003ccode\u003eGetHashCode\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Firestore API - Class AggregateField (3.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.10.0 (latest)](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.9.0/Google.Cloud.Firestore.AggregateField)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.8.0/Google.Cloud.Firestore.AggregateField)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.7.0/Google.Cloud.Firestore.AggregateField)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.6.0/Google.Cloud.Firestore.AggregateField)\n- [3.5.1](/dotnet/docs/reference/Google.Cloud.Firestore/3.5.1/Google.Cloud.Firestore.AggregateField)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.4.0/Google.Cloud.Firestore.AggregateField)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.3.0/Google.Cloud.Firestore.AggregateField)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.2.0/Google.Cloud.Firestore.AggregateField)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.1.0/Google.Cloud.Firestore.AggregateField)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.0.0/Google.Cloud.Firestore.AggregateField)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.5.0/Google.Cloud.Firestore.AggregateField)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.4.0/Google.Cloud.Firestore.AggregateField)\n- [2.3.1](/dotnet/docs/reference/Google.Cloud.Firestore/2.3.1/Google.Cloud.Firestore.AggregateField) \n\n public sealed class AggregateField : IEquatable\u003cAggregateField\u003e\n\nReference documentation and code samples for the Firestore API class AggregateField.\n\nRepresents a single aggregation within an [AggregateQuery](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateQuery). \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AggregateField \n\nImplements\n----------\n\n[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AggregateField](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField) \n\nInherited Members\n-----------------\n\n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Firestore](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)\n\nAssembly\n--------\n\nGoogle.Cloud.Firestore.dll\n\nProperties\n----------\n\n### Alias\n\n public string Alias { get; }\n\nThe alias for this aggregate field. This is either specified explicitly on construction,\nor may be defaulted.\n\nMethods\n-------\n\n### Average(string, string)\n\n public static AggregateField Average(string field, string alias = null)\n\nIt uses the server side aggregation Google.Cloud.Firestore.V1.StructuredAggregationQuery.Types.Aggregation.Avg representing a server-side average aggregation function.\n\n### Count()\n\n public static AggregateField Count()\n\nCreates an [AggregateField](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField) representing a server-side count aggregation function.\nThe `COUNT(*)` aggregation function operates on the entire document so it does not require a field reference.\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### Sum(string, string)\n\n public static AggregateField Sum(string field, string alias = null)\n\nCreates an [AggregateField](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.AggregateField) representing a server-side sum aggregation function."]]