Search.../

hasSome( )

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

Description

The hasSome() function refines a JoinRequestsQueryBuilder to only match items where any of the values of the array of the specified property equal any of the specified values.

Matching with hasSome() is case sensitive, so "text" is not equal to "Text".

Syntax

function hasSome(propertyName: string, values: Array<string>): JoinRequestsQueryBuilder

hasSome Parameters

NAME
TYPE
DESCRIPTION
propertyName
string

The property whose value will be compared with value.

Supported property:

  • status
values
Array<string>

The value to match against.

Returns

A JoinRequestsQueryBuilder object representing the refined query.

Was this helpful?

Add a hasSome filter to a query

Copy Code
1const query = joinRequests.queryJoinRequests().hasSome("status", ["APPROVED", "PENDING"]);
Create a query, add a hasSome filter, and run it

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinRequests } from 'wix-groups-backend';
3
4export const myQueryJoinRequestsFunction = webMethod(Permissions.Anyone, () => {
5 return joinRequests.queryJoinRequests()
6 .hasSome("status", ["APPROVED", "PENDING"])
7 .find()
8 .then((results) => {
9 if (results.items.length > 0) {
10 const items = results.items;
11 const firstItem = items[0];
12 const pageSize = results.pageSize;
13 const totalPages = results.totalPages;
14 const totalCount = results.totalCount;
15 const currentPage = results.currentPage();
16 const next = results.next();
17 const previous = results.prev();
18 const hasNext = results.hasNext();
19 const hasPrev = results.hasPrev();
20 const length = results.length;
21
22 return items;
23 } else {
24 // Handle case where no matching items found
25 }
26 })
27 .catch((error) => {
28 console.error(error);
29 })
30
31});