Cloud Datastore Client - Class AggregationQueryResult (1.25.0) Stay organized with collections Save and categorize content based on your preferences.
Reference documentation and code samples for the Cloud Datastore Client class AggregationQueryResult.
Represents the result of anAggregation Query
Example:
use Google\Cloud\Datastore\DatastoreClient;$datastore = new DatastoreClient();$query = $datastore->AggregationQuery();$query->kind('Companies');$query->filter('companyName', '=', 'Google');$query->limit(100);$query->addAggregation(Aggregation::count()->alias('total_upto_100'));$res = $datastore->runAggregationQuery($query);echo $res->get('total_upto_100');Namespace
Google \ Cloud \ Datastore \ QueryMethods
__construct
Create AggregationQueryResult object.
| Parameters | |
|---|---|
| Name | Description |
result | arrayResponse ofRunAggregationQuery |
mapper | Google\Cloud\Datastore\EntityMapper[Optional] Entity mapper to map datastore valuesto their equivalent php values incase of |
get
Get the Query Aggregation value.
Example:
$query = $datastore->AggregationQuery();$query->kind('Companies');$query->filter('companyName', '=', 'Google');$query->addAggregation(Aggregation::count()->alias('total'));$res = $client->runAggregationQuery($query);echo $res->get('total');| Parameter | |
|---|---|
| Name | Description |
alias | stringThe aggregation alias. |
| Returns | |
|---|---|
| Type | Description |
mixed | |
getQuery
Gets the value of query for example in case of a GqlQuery.
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Datastore\Query\AggregationQuery | |
getTransaction
Gets the transaction id when Aggregation is associated with a Transaction.
| Returns | |
|---|---|
| Type | Description |
string|null | |
getReadTime
Gets the timsstamp when Aggregation was executed.
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Core\Timestamp | |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-01-24 UTC.