Search.../

Introduction

The SessionQueryBuilder functions enable you to run, filter, and control which results a query returns.

Typically, you build a query using the session query function, refine the query by chaining SessionQueryBuilder functions, and then execute the query by chaining the find() function.

Note: Only users with Bookings Admin permissions can view participant information in a session query. You can override the permissions by setting the suppressAuth options to true in the find() function.

All queries must include the following SessionQueryBuilder functions:

  • ge("end.timestamp", "<timestamp value>")
  • lt("start.timestamp", "<timestamp value>")

For example, the following code queries all sessions between the specified start and end dates, and logs the first 5 results to the console.

import { sessions } from 'wix-bookings-backend';
sessions.querySessions()
.ge("end.timestamp", "2021-01-01T00:00:00.000Z")
.lt("start.timestamp", "2021-05-01T00:00:00.000Z")
.limit(5)
.find()
.then( (results) => {
console.log(results.items);
} );
javascript | Copy Code

Was this helpful?