Search...
contains( )
Refines a query to match items whose specified property value contains a specified string.
Description
The contains()
function refines a GroupsQueryBuilder
to only
match items where the value of the specified property contains the specified string.
Matching with contains()
is case-sensitive, so "TEXT"
does not contain "text"
.
You can only use contains()
with a property whose value is a String.
Syntax
function contains(propertyName: string, value: string): GroupsQueryBuilder
contains Parameters
NAME
TYPE
DESCRIPTION
propertyName
string
The property whose value will be compared with value
.
Supported property:
name
value
string
The value to match against.
Was this helpful?
Add a
contains
filter to a queryCopy Code
1const query = groups.queryGroups().contains("name", "art");
Create a query, add a
contains
filter, and run itCopy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { groups } from 'wix-groups-backend';34export const myQueryGroupsFunction = webMethod(Permissions.Anyone, () => {5 return groups.queryGroups()6 .contains("name", "art")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;2122 return items;23 } else {24 // Handle case where no matching items found25 }26 })27 .catch((error) => {28 console.error(error);29 })3031});