Search.../

hasSome( )

Refines a query to match items whose specified property contains any of the specified values.

Description

The hasSome() function refines a MembersQueryBuilder to match only items where the value of the specified propertyName equals any of the specified values. Matching strings with hasSome() is case-sensitive, so 'text' isn't equal to 'Text'. If the specified property is an array, hasSome() matches if any of that array's elements equal any of the specified values.

Syntax

function hasSome(propertyName: string, value: Array<any>): MembersQueryBuilder

hasSome Parameters

NAME
TYPE
DESCRIPTION
propertyName
Optional
string

Property whose value is compared with values.

value
Optional
Array<
any
>

Returns

Was this helpful?

Add a hasSome filter to a query

Copy Code
1const query = members.queryGroupMembers.hasSome('labelIds', [
2 'red',
3 'blue',
4 'purple',
5]);
6
Create a query, add a hasSome filter, and run it

Copy Code
1import { members } from 'wix-groups.v2';
2
3export async function myQueryFunction() {
4 const results = await members
5 .queryGroupMembers()
6 .hasSome('labelIds', ['red', 'blue', 'purple'])
7 .find();
8
9 if (results.items.length > 0) {
10 const items = results.items;
11 const firstItem = items[0];
12 const pageSize = results.pageSize;
13 const hasNext = results.hasNext();
14 const hasPrev = results.hasPrev();
15 const length = results.length;
16 const query = results.query;
17
18 return items;
19 } else {
20 // Handle if no matching items found
21 }
22}
23