Firestore API - Class AggregateField (3.5.1)

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
TypeDescription
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
NameDescription
fieldstring

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

aliasstring

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
TypeDescription
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
TypeDescription
AggregateField

Returns a new instance of AggregateField.

GetHashCode()

public override int GetHashCode()

Serves as the default hash function.

Returns
TypeDescription
int

A hash code for the current object.

Overrides

Sum(string, string)

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

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

Parameters
NameDescription
fieldstring

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

aliasstring

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
TypeDescription
AggregateField

Returns a new instance of AggregateField.