Firestore API - Class AggregateField (3.8.0)

public sealed class AggregateField : IEquatable<AggregateField>

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

Represents a single aggregation within an AggregateQuery.

Inheritance

object > AggregateField

Namespace

Google.Cloud.Firestore

Assembly

Google.Cloud.Firestore.dll

Properties

Alias

public string Alias { get; }

The alias for this aggregate field. This is either specified explicitly on construction, or may be defaulted.

Property Value
Type Description
string

Methods

Average(string, string)

public static AggregateField Average(string field, string alias = null)

It uses the server side aggregation Google.Cloud.Firestore.V1.StructuredAggregationQuery.Types.Aggregation.Avg representing a server-side average aggregation function.

Parameters
Name Description
field string

The field on which the average aggregation is performed. Must not be null.

alias string

Optional alias to identify the result of the aggregation in AggregateQuerySnapshot. If this is null, an alias of the form "Avg_{field}" is used.

Returns
Type Description
AggregateField

Returns a new instance of AggregateField.

Count()

public static AggregateField Count()

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.

Returns
Type Description
AggregateField

Returns a new instance of AggregateField.

GetHashCode()

public override int GetHashCode()
Returns
Type Description
int
Overrides

Sum(string, string)

public static AggregateField Sum(string field, string alias = null)

Creates an AggregateField representing a server-side sum aggregation function.

Parameters
Name Description
field string

The field on which the sum aggregation is performed. Must not be null.

alias string

Optional alias to identify the result of the aggregation in AggregateQuerySnapshot. If this is null, an alias of the form "Sum_{field}" is used.

Returns
Type Description
AggregateField

Returns a new instance of AggregateField.