Comparison
Aerospike comparison expressions allow you to evaluate values and return boolean results.
This guide explains operators such as eq
, ne
, lt
, gt
, le
, ge
, cmp_regex
,
and cmp_geo
. Code examples demonstrate how to implement these comparisons in database queries.
Ops
cmp_geo(left, right)
Returns true
if the left is either contained within or contains the right.
Name | Type |
---|---|
left | geojson_expr |
right | geojson_expr |
boolean_value
cmp_regex(regex_string, options_value, string)
Returns true
if the regex_string matches the string, otherwise returns false
.
Name | Type |
---|---|
regex_string | string_value |
options_value | integer_value |
string | string_expr |
boolean_value
eq(left, right)
Returns true
if the left is equal to the right, otherwise returns false
. left and right must result in the same fundamental type.
Note that an expression that uses the eq
operator to compare two unordered maps, or an ordered map with an unordered map, returns false
if the maps contain the same elements in different orders.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value
ge(left, right)
Returns true
if the left is greater than or equal to the right, otherwise returns false
. left and right must result in the same fundamental type.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value
gt(left, right)
Returns true
if the left is greater than to the right, otherwise returns false
. left and right must result in the same fundamental type.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value
le(left, right)
Returns true
if the left is less than or equal to the right, otherwise returns false
. left and right must result in the same fundamental type.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value
lt(left, right)
Returns true
if the left is less than the right, otherwise returns false
. left and right must result in the same fundamental type.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value
Find where bin ‘lname’ between ‘o’ and ‘p’.
as_exp_build(predexp, as_exp_and( as_exp_cmp_ge(as_exp_bin_str("lname"), as_exp_str("o")) as_exp_cmp_lt(as_exp_bin_str("lname"), as_exp_str("p"))));
Expression exp = Exp.build( Exp.and( Exp.ge(Exp.stringBin("lname"), Exp.val("o")) Exp.lt(Exp.stringBin("lname"), Exp.val("p"))));
ne(left, right)
Returns true
if the left is not equal to the right, otherwise returns false
. left and right must result in the same fundamental type.
Name | Type |
---|---|
left | expr |
right | expr |
boolean_value