Search...
ge( )
Developer Preview
Refines a query to match items where the specified property is greater than or equal to the specified value.
Description
The ge()
function refines a CommentsQueryBuilder
to match only items where the value of the specified propertyName
is greater than or equal to the specified value
.
ge()
matches only values of the same type. For example, 0
stored as a number doesn't match '0'
stored as a string.
If a property contains a number stored as a string (for example, '0'
), that value is compared alphabetically and not numerically. If a property doesn't have a value, that value is ranked lowest.
The following types of properties can be compared:
- Number: Compares numerically.
- Date: Compares JavaScript Date objects.
- String: Compares lexicographically, so
'abc'
is greater than'ABC'
.
Syntax
function ge(propertyName: string, value: any): CommentsQueryBuilder
ge 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 a
ge
filter to a queryCopy Code
1const query = comments.queryComments.ge('total', 1212);2
Create a query, add a
ge
filter, and run itCopy Code
1import { comments } from 'wix-comments.v2';23export async function myQueryFunction() {4 const results = await comments.queryComments().ge('total', 1212).find();56 if (results.items.length > 0) {7 const items = results.items;8 const firstItem = items[0];9 const pageSize = results.pageSize;10 const hasNext = results.hasNext();11 const hasPrev = results.hasPrev();12 const length = results.length;13 const query = results.query;1415 return items;16 } else {17 // Handle if no matching items found18 }19}20