Optional. Optional name of the property to store the result of the aggregation. If not provided, Datastore will pick a default name following the formatproperty_<incremental_id++>. For example:AGGREGATE COUNT_UP_TO(1) AS count_up_to_1, COUNT_UP_TO(2), COUNT_UP_TO(3) AS count_up_to_3, COUNT(*) OVER ( ... );becomes:AGGREGATE COUNT_UP_TO(1) AS count_up_to_1, COUNT_UP_TO(2) AS property_1, COUNT_UP_TO(3) AS count_up_to_3, COUNT(*) AS property_2 OVER ( ... );Requires: * * Must be unique across all aggregation aliases. * * Conform toentity property namelimitations.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Datastore V1 Client - Class Aggregation (1.33.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.33.1 (latest)](/php/docs/reference/cloud-datastore/latest/V1.AggregationQuery.Aggregation)\n- [1.33.0](/php/docs/reference/cloud-datastore/1.33.0/V1.AggregationQuery.Aggregation)\n- [1.32.3](/php/docs/reference/cloud-datastore/1.32.3/V1.AggregationQuery.Aggregation)\n- [1.31.0](/php/docs/reference/cloud-datastore/1.31.0/V1.AggregationQuery.Aggregation)\n- [1.30.0](/php/docs/reference/cloud-datastore/1.30.0/V1.AggregationQuery.Aggregation)\n- [1.29.2](/php/docs/reference/cloud-datastore/1.29.2/V1.AggregationQuery.Aggregation)\n- [1.28.2](/php/docs/reference/cloud-datastore/1.28.2/V1.AggregationQuery.Aggregation)\n- [1.26.0](/php/docs/reference/cloud-datastore/1.26.0/V1.AggregationQuery.Aggregation)\n- [1.25.0](/php/docs/reference/cloud-datastore/1.25.0/V1.AggregationQuery.Aggregation)\n- [1.24.4](/php/docs/reference/cloud-datastore/1.24.4/V1.AggregationQuery.Aggregation)\n- [1.23.0](/php/docs/reference/cloud-datastore/1.23.0/V1.AggregationQuery.Aggregation)\n- [1.22.1](/php/docs/reference/cloud-datastore/1.22.1/V1.AggregationQuery.Aggregation)\n- [1.21.2](/php/docs/reference/cloud-datastore/1.21.2/V1.AggregationQuery.Aggregation)\n- [1.19.0](/php/docs/reference/cloud-datastore/1.19.0/V1.AggregationQuery.Aggregation)\n- [1.18.1](/php/docs/reference/cloud-datastore/1.18.1/V1.AggregationQuery.Aggregation)\n- [1.17.1](/php/docs/reference/cloud-datastore/1.17.1/V1.AggregationQuery.Aggregation) \nReference documentation and code samples for the Cloud Datastore V1 Client class Aggregation.\n\nDefines an aggregation that produces a single result.\n\nGenerated from protobuf message `google.datastore.v1.AggregationQuery.Aggregation`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Datastore \\\\ V1 \\\\ AggregationQuery\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getCount\n\nCount aggregator.\n\n### hasCount\n\n### setCount\n\nCount aggregator.\n\n### getSum\n\nSum aggregator.\n\n### hasSum\n\n### setSum\n\nSum aggregator.\n\n### getAvg\n\nAverage aggregator.\n\n### hasAvg\n\n### setAvg\n\nAverage aggregator.\n\n### getAlias\n\nOptional. Optional name of the property to store the result of the\naggregation.\n\nIf not provided, Datastore will pick a default name following the format\n`property_\u003cincremental_id++\u003e`. For example: \n\n AGGREGATE\n COUNT_UP_TO(1) AS count_up_to_1,\n COUNT_UP_TO(2),\n COUNT_UP_TO(3) AS count_up_to_3,\n COUNT(*)\n OVER (\n ...\n );\n\nbecomes: \n\n AGGREGATE\n COUNT_UP_TO(1) AS count_up_to_1,\n COUNT_UP_TO(2) AS property_1,\n COUNT_UP_TO(3) AS count_up_to_3,\n COUNT(*) AS property_2\n OVER (\n ...\n );\n\nRequires:\n\n- Must be unique across all aggregation aliases.\n- Conform to [entity property\n name](/php/docs/reference/cloud-datastore/latest/V1.Entity#_Google_Cloud_Datastore_V1_Entity__getProperties__) limitations.\n\n### setAlias\n\nOptional. Optional name of the property to store the result of the\naggregation.\n\nIf not provided, Datastore will pick a default name following the format\n`property_\u003cincremental_id++\u003e`. For example: \n\n AGGREGATE\n COUNT_UP_TO(1) AS count_up_to_1,\n COUNT_UP_TO(2),\n COUNT_UP_TO(3) AS count_up_to_3,\n COUNT(*)\n OVER (\n ...\n );\n\nbecomes: \n\n AGGREGATE\n COUNT_UP_TO(1) AS count_up_to_1,\n COUNT_UP_TO(2) AS property_1,\n COUNT_UP_TO(3) AS count_up_to_3,\n COUNT(*) AS property_2\n OVER (\n ...\n );\n\nRequires:\n\n- Must be unique across all aggregation aliases.\n- Conform to [entity property\n name](/php/docs/reference/cloud-datastore/latest/V1.Entity#_Google_Cloud_Datastore_V1_Entity__getProperties__) limitations.\n\n### getOperator"]]