find( )


Returns the items that match the query.

The find() function returns a Promise that resolves to the results found by the query and some information about the results. The Promise is rejected if find() is called with incorrect permissions or if any of the functions used to refine the query are invalid.

Use the options parameter to run find() without checking for permissions.

Method Declaration
Copy
function find(options: QueryOptions): Promise<WixBookingsQueryResult>;
Method Parameters
optionsQueryOptions

Options to use when performing a query or query count.

Returns
Return Type:Promise<WixBookingsQueryResult>
JavaScript
import { bookings } from "wix-bookings-backend"; // ... bookings .queryBookings() .find() .then((results) => { if (results.items.length > 0) { let items = results.items; let firstItem = items[0]; let totalCount = results.totalCount; let pageSize = results.pageSize; let currentPage = results.currentPage; let totalPages = results.totalPages; let hasNext = results.hasNext(); let hasPrev = results.hasPrev(); let length = results.length; let query = results.query; } else { // handle case where no matching items found } }) .catch((error) => { let errorMsg = error.message; let code = error.code; });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?