Search.../

eq( )

Refines a query to match items whose specified property value equals the specified value.

Description

The eq() function refines a CreateRequestsQueryBuilder to only match items where the value of the specified property equals the specified value.

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.

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

Syntax

function eq(propertyName: string, value: *): CreateRequestsQueryBuilder

eq Parameters

NAME
TYPE
DESCRIPTION
propertyName
string

The property whose value will be compared with value. Supported property:

  • status
value
*

The value to match against.

Returns

A CreateRequestsQueryBuilder object representing the refined query.

Was this helpful?

Add an eq filter to a query

Copy Code
1const query = createRequests.queryCreateRequests().eq("status", "APPROVED");
Create a query, add an eq filter, and run it

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