Search.../

hasNext( )

Indicates if the query has more results.

Authorization

Request

This endpoint does not take any parameters

Response Object

true if there are more results.

Returns an empty object.

Status/Error Codes

Was this helpful?

Get whether the query result object has more results

Copy Code
1let hasNext = results.hasNext(); // true
Iterate through all pages of query results

This example demonstrates how to get all query results, bypassing the maximum limit of 1000.

Copy Code
1import { sessions } from "wix-bookings-backend";
2
3async function retrieveAllItems() {
4 let allItems = [];
5
6 let results = await sessions.querySessions()
7 .ge("end.timestamp", "2021-01-01T00:00:00.000Z")
8 .lt("start.timestamp", "2021-05-01T00:00:00.000Z")
9 .limit(100)
10 .find();
11 allItems = allItems.concat(results.items);
12
13 while (results.hasNext()) {
14 results = await results.next();
15 allItems = allItems.concat(results.items);
16 }
17 return allItems;
18}
19