Cloud Firestore V1 Client - Class Avg (1.43.1)

Reference documentation and code samples for the Cloud Firestore V1 Client class Avg.

Average of the values of the requested field.

  • Only numeric values will be aggregated. All non-numeric values including NULL are skipped.
  • If the aggregated values contain NaN, returns NaN. Infinity math follows IEEE-754 standards.
  • If the aggregated value set is empty, returns NULL.
  • Always returns the result as a double.

Generated from protobuf message google.firestore.v1.StructuredAggregationQuery.Aggregation.Avg

Namespace

Google \ Cloud \ Firestore \ V1 \ StructuredAggregationQuery \ Aggregation

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ field Google\Cloud\Firestore\V1\StructuredQuery\FieldReference

The field to aggregate on.

getField

The field to aggregate on.

Returns
Type Description
Google\Cloud\Firestore\V1\StructuredQuery\FieldReference|null

hasField

clearField

setField

The field to aggregate on.

Parameter
Name Description
var Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
Returns
Type Description
$this