group( )


Groups items together in an aggregation.

The group() function refines a WixDataAggregate so that its items are grouped by the specified property or properties.

You can perform aggregations on the groups using the following functions:

To filter grouped results, use the having() function.

Notes:

  • Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.
  • You can only call the group() function once per aggregate query.
Method Declaration
Copy
function group(propertyName: Array<string>): WixDataAggregate;
Method Parameters
propertyNameArray<string>Required

The property or properties to group on.

Returns
Return Type:WixDataAggregate
JavaScript
let newAggregate = aggregate.group("state");
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?