Cloud Datastore Client - Class Aggregation (1.23.0)

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());

Namespace

Google \ Cloud \ Datastore \ Query

Methods

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

static::count

Creates count aggregation properties.

Example:

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