Search.../

items

Returns an array of serviceOptionsAndVariants items that match the query.

Description

items contains the current page of results retrieved by the query. If no results match the query, items is an empty array. The page size is defined by the limit() function and can be retrieved using the pageSize property. You can use the next() and prev() functions returned by serviceOptionsAndVariants to navigate the pages of a query result.

Type:

Array<
ServiceOptionsAndVariants
>
NAME
TYPE
DESCRIPTION
_id
string

ID of the serviceOptionsAndVariants object.

maxPrice
Money

Price of the most expensive service variant.

minPrice
Money

Price of the cheapest service variant.

options
ServiceOptions

Service options. Note that currently only a single option is supported per service.

revision
string

Revision number, which increments by 1 each time the serviceOptionsAndVariants object is updated. To prevent conflicting changes, the current revision must be passed when updating and deleting the serviceOptionsAndVariants object.

Ignored when creating a serviceOptionsAndVariants object.

serviceId
string

ID of the service related to these options and variants.

variants
ServiceVariants

Information about the service's variants.

Was this helpful?

Get items from a query result

Copy Code
1const returnedItems = results.items;
2
Perform a query and get items from the result

Copy Code
1import { serviceOptionsAndVariants } from 'wix-bookings.v2';
2
3export async function myQueryFunction() {
4 const results = await serviceOptionsAndVariants
5 .queryServiceOptionsAndVariants()
6 .find();
7
8 const returnedItems = results.items;
9
10 if (returnedItems.length > 0) {
11 return items;
12 } else {
13 // Handle if no matching items found
14 }
15}
16