Search...
hasNext( )
Indicates if the query has more results.
Syntax
function hasNext(): boolean
hasNext Parameters
This function does not take any parameters.
Returns
true
if there are more results.
Return Type:
boolean
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";23async function retrieveAllItems() {4 let allItems = [];56 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);1213 while (results.hasNext()) {14 results = await results.next();15 allItems = allItems.concat(results.items);16 }17 return allItems;18}19