Result of SUM aggregation can be a integer or a float.
Sum of integers which exceed maxinum integer value returns a float.
Sum of numbers exceeding max float value returnsINF.
Sum of data which containsNaNreturnsNaN.
Non numeric values are ignored.
Result of AVG aggregation can be a float or a null.
Average of empty valid data set returnnull.
Average of numbers exceeding max float value returnsINF.
Average of data which containsNaNreturnsNaN.
Non numeric values are ignored.
[[["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 Client - Class Aggregation (1.33.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.33.1 (latest)](/php/docs/reference/cloud-datastore/latest/Query.Aggregation)\n- [1.33.0](/php/docs/reference/cloud-datastore/1.33.0/Query.Aggregation)\n- [1.32.3](/php/docs/reference/cloud-datastore/1.32.3/Query.Aggregation)\n- [1.31.0](/php/docs/reference/cloud-datastore/1.31.0/Query.Aggregation)\n- [1.30.0](/php/docs/reference/cloud-datastore/1.30.0/Query.Aggregation)\n- [1.29.2](/php/docs/reference/cloud-datastore/1.29.2/Query.Aggregation)\n- [1.28.2](/php/docs/reference/cloud-datastore/1.28.2/Query.Aggregation)\n- [1.26.0](/php/docs/reference/cloud-datastore/1.26.0/Query.Aggregation)\n- [1.25.0](/php/docs/reference/cloud-datastore/1.25.0/Query.Aggregation)\n- [1.24.4](/php/docs/reference/cloud-datastore/1.24.4/Query.Aggregation)\n- [1.23.0](/php/docs/reference/cloud-datastore/1.23.0/Query.Aggregation)\n- [1.22.1](/php/docs/reference/cloud-datastore/1.22.1/Query.Aggregation)\n- [1.21.2](/php/docs/reference/cloud-datastore/1.21.2/Query.Aggregation)\n- [1.19.0](/php/docs/reference/cloud-datastore/1.19.0/Query.Aggregation)\n- [1.18.1](/php/docs/reference/cloud-datastore/1.18.1/Query.Aggregation)\n- [1.17.1](/php/docs/reference/cloud-datastore/1.17.1/Query.Aggregation) \nReference documentation and code samples for the Cloud Datastore Client class Aggregation.\n\nRepresents Aggregation properties.\n\nExample: \n\n $count = Aggregation::count();\n $count-\u003ealias('count');\n $count-\u003elimit(100);\n\n echo json_encode($count-\u003egetProps());\n\nAggregations considers non existing property name as an empty query set\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Datastore \\\\ Query\n\nMethods\n-------\n\n### alias\n\nSet the aggregation alias.\n\nExample: \n\n $count = Aggregation-\u003ecount();\n $count-\u003ealias('total');\n\n echo $count-\u003eprops()['count']['alias'];\n\n### getProps\n\nGet the array representation for the aggregation.\n\n### static::count\n\nCreates count aggregation properties.\n\nExample: \n\n $count = Aggregation::count();\n\n### static::sum\n\nCreates sum aggregation properties.\n\nExample: \n\n $sum = Aggregate::sum('property_to_aggregate_upon');\n\nResult of SUM aggregation can be a integer or a float.\nSum of integers which exceed maxinum integer value returns a float.\nSum of numbers exceeding max float value returns `INF`.\nSum of data which contains `NaN` returns `NaN`.\nNon numeric values are ignored.\n\n### static::avg\n\nCreates average aggregation properties.\n\nExample: \n\n $avg = Aggregate::avg('property_to_aggregate_upon');\n\nResult of AVG aggregation can be a float or a null.\nAverage of empty valid data set return `null`.\nAverage of numbers exceeding max float value returns `INF`.\nAverage of data which contains `NaN` returns `NaN`.\nNon numeric values are ignored."]]