afterAggregate( )


A hook triggered after an aggregation operation.

The afterAggregate() hook allows you to modify the aggregation results before they are returned to the caller. The hook runs for each item in the items array within the WixDataAggregateResult object, after the aggregation operation finishes and before the aggregate() method returns.

Return an object or a Promise that resolves to an object. If the returned value is of the wrong type, it is ignored.

If returning a Promise, the object is used as the result regardless of whether the Promise is fulfilled or rejected. A rejected Promise also triggers the onFailure() hook, if it has been registered.

Method Declaration
Copy
Method Parameters
itemItemRequired

The aggregation result item.


contextHookContextRequired

Contextual information about the hook.

Returns
Return Type:Promise<object> | object
Did this help?