Search...
hasSome( )
Refines a query to match items whose specified property contains any of the specified value
parameters.
Description
The hasSome()
function refines a SessionQueryBuilder
to only match items where the value of the specified property equals any of the specified values in the array.
Matching strings with hasSome()
is case sensitive, so "text"
is not equal to "Text"
.
You can specify a list of values to match by providing comma-separated String types as the value
parameters. You can also specify a list of these values by including them in an array and providing the array as the value
.
Syntax
function hasSome(propertyName: string, value: Array<string>): SessionQueryBuilder
hasSome Parameters
NAME
TYPE
DESCRIPTION
propertyName
string
The property whose values will be compared with value
.
Supported properties:
sessionId
type
tags
value
Array<string>
The values to match against.
Was this helpful?
Add a hasSome filter to a query
Copy Code
1let query = sessions.querySessions().hasSome("tags", ["GROUP", "Blocked"]);
Create a query, add a hasSome filter, and run it
Copy Code
1import { sessions } from "wix-bookings-backend";23// ...45sessions.querySessions()6 .hasSome("tags",["GROUP", "Blocked"])7 .ge("end.timestamp", "2021-01-01T00:00:00.000Z")8 .lt("start.timestamp", "2021-05-01T00:00:00.000Z")9 .find()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 });