Search...
eq( )
Developer Preview
Refines a query to match items where the specified property equals the specified value.
Description
The eq()
function refines a ServicesQueryBuilder
to match only items where the value of the specified propertyName
equals the specified value
.
eq()
matches only values of the same type. For example, 0
stored as a number doesn't match '0'
stored as a string.
Matching strings with eq()
is case-sensitive, so 'text'
isn't equal to 'Text'
.
Syntax
function eq(propertyName: string, value: any): ServicesQueryBuilder
eq Parameters
NAME
TYPE
DESCRIPTION
propertyName
Optional
string
Property whose value is compared with value
.
value
Optional
any
Value to compare against.
Returns
Return Type:
Was this helpful?
Add an
eq
filter to a queryCopy Code
1const query = services.queryServices.eq('_id', 'some-id');2
Create a query, add an
eq
filter, and run itCopy Code
1import { services } from 'wix-bookings.v2';23export async function myQueryFunction() {4 const results = await services5 .queryServices()6 .eq('_id', 'bb19b637-74ce-55d3-ae32-430b588051da')7 .find();89 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;1718 return items;19 } else {20 // Handle if no matching items found21 }22}23