beforeAggregate( )


A hook triggered before an aggregation operation.

The beforeAggregate() hook runs when the aggregate() is called, and allows you to modify the WixDataAggregate object before the aggregation operation runs.

Return a WixDataAggregate object or a Promise that resolves to a WixDataAggregate object. The returned object is the aggregation that runs on the collection instead of the original aggregation created by the aggregate() method.

If the returned value is of the wrong type, the value is ignored.

A rejected Promise blocks the call to aggregate() and triggers the onFailure() hook, if it has been registered.

Method Declaration
Copy
Method Parameters
aggregateWixDataAggregateRequired

The original WixDataAggregate object.


contextUpdateHookContextRequired

Contextual information about the hook.

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