Search.../

items

Gets the aggregated values.

Description

The current page of items retrieved by the aggregation.

The page size is defined by the limit() function and navigating through pages is done with the next() function.

When no items match the aggregation, the items array is empty.

Type:

Array<Object>Read Only

Was this helpful?

Get the aggregate values

Copy Code
1let items = results.items;
Run an aggregation and get the aggregate values

Copy Code
1import wixData from 'wix-data';
2
3wixData.aggregate("PopulationData")
4 .group("state")
5 .max("population")
6 .run()
7 .then((results) => {
8 if (results.items.length > 0) {
9 let items = results.items; // see below
10 } else {
11 // handle case where no matching items found
12 }
13 });
14
15/* Given the sample data above, items is:
16 * [
17 * {"_id": "NY", "populationMax": 8192000},
18 * {"_id": "CA", "populationMax": 3796000},
19 * {"_id": "FL", "populationMax": 401000}
20 * ]
21 */