Cloud Datastore Client - Class Aggregation (1.21.2)

Reference documentation and code samples for the Cloud Datastore Client class Aggregation.

Represents Count Aggregation properties.

Example:

$count = Aggregation::count();
$count->alias('count');
$count->limit(100);

echo json_encode($count->getProps());

Methods

count

Creates count aggregation properties.

Example:

$count = Aggregation::count();
Returns
TypeDescription
Google\Cloud\Datastore\Query\Aggregation

alias

Set the aggregation alias.

Example:

$count = Aggregation->count();
$count->alias('total');

echo $count->props()['count']['alias'];
Parameter
NameDescription
alias string

The alias for aggregation.

Returns
TypeDescription
Google\Cloud\Datastore\Query\Aggregation

getProps

Get the array representation for the aggregation.

Returns
TypeDescription
array