Search...
eq( )
Refines a query to match items whose specified property value equals the specified value.
Description
The eq()
function refines a SessionQueryBuilder
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: *): SessionQueryBuilder
eq Parameters
NAME
TYPE
DESCRIPTION
propertyName
string
The property whose value will be compared with value
.
Supported properties:
type
tags
scheduleId
value
*
The value to match against.
Was this helpful?
Add an equals filter to a query
Copy Code
1let query = sessions.querySessions().eq("scheduleId", "9299760d-8a4a-4f89-b348-1fc611f4be17")
Create a query, add an equals filter, and run it
Copy Code
1import { sessions } from "wix-bookings-backend";23// ...45sessions.querySessions()6 .eq("scheduleId", "9299760d-8a4a-4f89-b348-1fc611f4be17")7 .ge("end.timestamp","2020-01-01T08:00:00.000Z")8 .lt("start.timestamp","2021-06-01T08:00:00.000Z")9 .find({suppressAuth:true})10 .then((results) => {11 if (results.items.length > 0) {12 const items = results.items;13 const firstItem = items[0];14 const totalCount = results.totalCount;15 const pageSize = results.pageSize;16 const currentPage = results.currentPage;17 const totalPages = results.totalPages;18 const hasNext = results.hasNext();19 const hasPrev = results.hasPrev();20 const length = results.length;21 const query = results.query;22 } else {23 // handle case where no matching items found24 }25 })26 .catch((error) => {27 console.error(error);28 });