Search.../

lt( )

Refines a query to match items whose specified property value is less than the specified value.

Description

The lt() function refines a SessionQueryBuilder to only match items where the value of the specified property is less than the specified value.

Syntax

function lt(propertyName: string, value: Date): SessionQueryBuilder

lt Parameters

NAME
TYPE
DESCRIPTION
propertyName
string

The property whose value will be compared with value.

Supported properties:

  • end.timestamp
value
Date

The value to match against.

Returns

A SessionQueryBuilder object representing the refined query.

Was this helpful?

Add a less than filter to a query

Copy Code
1let query = sessions.querySessions().lt("start.timestamp", "2021-04-27T10:00:00.000Z");
Create a query, add a less than filter, and run it

Copy Code
1import { sessions } from "wix-bookings-backend";
2
3// ...
4
5sessions.querySessions()
6 .ge("end.timestamp", "2021-01-01T00:00:00.000Z")
7 .lt("start.timestamp", "2021-05-01T00:00:00.000Z")
8 .find()
9 .then((results) => {
10 if (results.items.length > 0) {
11 const items = results.items;
12 const firstItem = items[0];
13 const totalCount = results.totalCount;
14 const pageSize = results.pageSize;
15 const currentPage = results.currentPage;
16 const totalPages = results.totalPages;
17 const hasNext = results.hasNext();
18 const hasPrev = results.hasPrev();
19 const length = results.length;
20 const query = results.query;
21 } else {
22 // handle case where no matching items found
23 }
24 })
25 .catch((error) => {
26 console.error(error);
27 });