Search...
hasSome( )
Refines a query to match items whose specified property contains any of the specified value
parameters.
Description
The hasSome()
function refines a PublicPlansQueryBuilder
to
only match items where any of the values of the array of the specified property equal any of
the specified values.
Matching strings with hasSome()
is case sensitive, so "text"
is not equal to "Text"
.
Syntax
function hasSome(propertyName: string, values: Array<string>): PublicPlansQueryBuilder
hasSome Parameters
NAME
TYPE
DESCRIPTION
propertyName
string
The property whose values will be compared with values
. The property type must be an array of strings.
Supported property: _id
values
Array<string>
The values to match against.
Returns
A PublicPlansQueryBuilder
object representing the refined query.
Return Type:
Was this helpful?
Add a "has some" filter to a query
Copy Code
1const query = wixPricingPlansBackend.queryPublicPlans()2 .hasSome("_id", [3 "001c0674-d7c9-4c77-acb5-b492b427b201",4 "003d0674-d7c9-4d88-acb5-b492b427b302",5 "011d0123-d7c9-5e44-acb5-d300a123b321"6 ]7);
Create a query, add a "has some" filter, and run it
Copy Code
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';23// ...45wixPricingPlansBackend.queryPublicPlans()6 .hasSome("_id", [7 "001c0674-d7c9-4c77-acb5-b492b427b201",8 "003d0674-d7c9-4d88-acb5-b492b427b302",9 "011d0123-d7c9-5e44-acb5-d300a123b321"10 ])11 .find()12 .then((results) => {13 if (results.items.length > 0) {14 const items = results.items;15 const firstItem = items[0];16 const totalCount = results.totalCount;17 const pageSize = results.pageSize;18 const currentPage = results.currentPage;19 const totalPages = results.totalPages;20 const hasNext = results.hasNext();21 const hasPrev = results.hasPrev();22 const length = results.length;23 const query = results.query;24 } else {25 // handle case where no matching items found26 }27 })28 .catch((error) => {29 const queryError = error;30 });