Search.../

next( )

Retrieves the next page of query results.

Description

The next() function retrieves the next page of query results. The page size is defined by the limit() function and can be retrieved using the pageSize property. You can use the next() and prev() functions returned by groups to navigate the pages of a query result. If items are added or removed between calls to next(), the values returned by GroupsQueryBuilder may change.

Syntax

function next(): Promise<GroupsQueryResult>

next Parameters

This function does not take any parameters.

Returns

Return Type:

Was this helpful?

Get next from a query result

Copy Code
1const nextPage = results.next();
2
Perform a query and get next from the result

Copy Code
1import { groups } from 'wix-groups.v2';
2
3export async function myQueryFunction() {
4 const results = await groups.queryGroups().find();
5
6 return results.next();
7}
8
Iterate through all pages of query results

Copy Code
1import { groups } from 'wix-groups.v2';
2
3export async function myQueryFunction() {
4 let allItems = [];
5
6 const results = await groups.queryGroups().limit(1000).find();
7 allItems.push(results.items);
8
9 while (results.hasNext()) {
10 results = await results.next();
11 allItems.push(results.items);
12 }
13
14 return allItems;
15}
16