> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: next() # Method package: wixData # Method menu location: wixData --> WixDataAggregateResult --> next # Method Link: https://dev.wix.com/docs/velo/apis/wix-data/wix-data-aggregate-result/next.md # Method Description: Retrieves the next page of aggregate results. The `next()` function retrieves the next page of aggregate results. The page size is defined by the [`limit()`](wix-data.WixDataAggregate.html#limit) function. If items are added or removed between calls to `next()` the values returned by `WixDataAggregateResult` may change. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get the next page of an aggregate result ```javascript oldResults.next() .then((newResults) => { let items = newResults.items; let numItems = newResults.length; let hasNext = newResults.hasNext(); }) .catch((error) => { let errorMsg = error.message; let code = error.code; }); ``` ## Iterate through all pages of aggregate results ```javascript let results = await wixData.aggregate("Cities") .group("city") .limit(3) .run(); console.log(results.items); while(results.hasNext()) { console.log("---▼ Next Page ▼---"); results = await results.next(); console.log(results.items); } /* Logs: * [{"_id":"San Diego"},{"_id":"Orlando"},{"_id":"San Francisco"}] * ---▼ Next Page ▼--- * [{"_id":"Buffalo"},{"_id":"Miami"},{"_id":"Los Angeles"}] * ---▼ Next Page ▼--- * [{"_id":"Miami"}] */ ``` ---