Search...
find( )
Returns the resource catalog items that match the query.
Description
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.
Syntax
function find([options: QueryOptions]): Promise<ResourceCatalogQueryResult>
find Parameters
NAME
TYPE
DESCRIPTION
options
Optional
QueryOptions
Options to use when performing a query.
Returns
Fulfilled - A Promise that resolves to the results of the query. Rejected - Error that caused the query to fail.
Return Type:
Promise<ResourceCatalogQueryResult>
Was this helpful?
Perform a find on a query
Copy Code
1import { resources } from "wix-bookings-backend";23// ...45resources.queryResourceCatalog()6 .find()7 .then((results) => {8 if (results.items.length > 0) {9 const items = results.items;10 const firstItem = items[0];11 const totalCount = results.totalCount;12 const pageSize = results.pageSize;13 const currentPage = results.currentPage;14 const totalPages = results.totalPages;15 const hasNext = results.hasNext();16 const hasPrev = results.hasPrev();17 const length = results.length;18 const query = results.query;19 } else {20 // handle case where no matching items found21 }22 })23 .catch((error) => {24 console.error(error);25 });
Perform a find on a query using options
Copy Code
1import { resources } from "wix-bookings-backend";23// ...4const options = {5 "suppressAuth": true6};78resources.queryResourceCatalog()9 .find(options)10 .then((results) => {11 if (results.items.length > 0) {12 const items = results.items;13 const firstItem = items[0];14 const totalCount = results.totalCount;15 const pageSize = results.pageSize;16 const currentPage = results.currentPage;17 const totalPages = results.totalPages;18 const hasNext = results.hasNext();19 const hasPrev = results.hasPrev();20 const length = results.length;21 const query = results.query;22 } else {23 // handle case where no matching items found24 }25 })26 .catch((error) => {27 console.error(error);28 });