run( )


Runs the aggregation and returns the results.

The run() function returns a Promise that resolves to the results found by the aggregation and some information about the results.

Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.

Method Declaration
Copy
function run(options: RunOptions): Promise<WixDataAggregateResult>;
Method Parameters
optionsRunOptions

Options to use when running an aggregation.

Returns
Return Type:Promise<WixDataAggregateResult>
JavaScript
aggregate .run() .then((results) => { if (results.items.length > 0) { let items = results.items; let numItems = results.length; let hasNext = results.hasNext(); } else { // handle case where no matching items found } }) .catch((error) => { let errorMsg = error.message; let code = error.code; });
Errors

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

Did this help?