Search.../

ne( )

Developer Preview

Refines a query to match items where the specified property doesn't equal the specified value.

Description

The ne() function refines a ServiceOptionsAndVariantssQueryBuilder to match only items where the value of the specified propertyName doesn't equal the specified value. ne() 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 ne() is case-sensitive, so 'text' isn't equal to 'Text'.

Syntax

function ne(propertyName: string, value: any): ServiceOptionsAndVariantsListQueryBuilder

ne Parameters

NAME
TYPE
DESCRIPTION
propertyName
Optional
string

Property whose value is compared with value.

value
Optional
any

Value to compare against.

Was this helpful?

Add an ne filter to a query

Copy Code
1const query = serviceOptionsAndVariants.queryServiceOptionsAndVariants.ne(
2 '_id',
3 '"some-id"'
4);
5
Create a query, add an ne filter, and run it

Copy Code
1import { serviceOptionsAndVariants } from 'wix-bookings.v2';
2
3export async function myQueryFunction() {
4 const results = await serviceOptionsAndVariants
5 .queryServiceOptionsAndVariants()
6 .ne('_id', '"some-id"')
7 .find();
8
9 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;
17
18 return items;
19 } else {
20 // Handle if no matching items found
21 }
22}
23