List expressions
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
List expressions read and modify list values inside an expression tree. For the data type itself and its Operate API, see List.
Read expressions (list_size, list_get_by_index, list_get_by_value, the rank and range variants) evaluate to whatever result_type selects — a count, an index, a rank, or a value. That makes them projection: they shape what a command returns for each record, in operate, in a batch, and in a query. Wrap one in comparison or logic to get the Boolean a record filter needs.
Modify expressions (list_append, list_insert, list_remove_by_*, list_set, list_increment, list_sort, list_clear) evaluate to a new list and leave the record untouched. Storing that value takes a write operation expression; see Operations and expressions for how the two APIs differ.
A list operand is a bin, read with bin_list, or any expression that evaluates to a list. Reading stored data can evaluate to unknown; see Unknown results.
For nested collection data and path filters, see Querying collection data types and Path expressions.
The Developer SDK’s AEL text syntax expresses the same list operations as path functions, for example $.tags.append('new').
Composing expressions
An expression evaluates to a value, and that value is what the next expression operates on — see Expressions compose.
Every list operation takes its bin operand that way: not only a named list bin, but the result of any expression evaluating to a list. list_append shows the pattern — its example takes the list_size of the appended-to list, so the size counts the new element while the record keeps the original.
Two differences from the CDT List API
-
A list modify expression evaluates to the whole modified list. The matching CDT List operation returns something narrower and operation-specific:
appendreturns the new element count, and the remove-by operations return whatresult_typeselects. -
The single-element getters,
list_get_by_indexandlist_get_by_rank, take atypeargument in addition toresult_type. A list element can be of any type, and an expression is strictly typed, so the getter has to declare the type it evaluates to. Reading an element of another type fails the expression.
Path expressions
List expressions such as list_get_by_value can be used inside
path expression filter contexts. For example, the IN-list
membership pattern uses list_get_by_value with a loop variable to check whether a map key
belongs to a given list of IDs. See the
path expressions performance page for a detailed
comparison of IN-list filtering approaches.
Each operation’s Example shows the code in nine tabs: Aerospike Expression Language (AEL) text on the Java SDK and Python SDK tabs, and the Exp builder on the other seven. See the AEL reference for AEL grammar.
Modify
list_append(context, policy, value, bin)Returns the list with value appended to the end. It does not create a bin that does not exist, unlike the append CDT List operation, which does.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
policy | List policy | Write flags for the operation. See Write flags. A violated flag fails the expression, unless |
value | any | Element to append to the list. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Hypothetical filter using the list after appending horror to tags (modify expressions evaluate on a temporary list value).
String exp = "$.tags.append('horror').count() > 2";exp = "$.tags.append('horror').count() > 2"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, string_val};use aerospike::ListPolicy;
let exp = gt( list_exp::size( list_exp::append( ListPolicy::default(), string_val("horror".into()), list_bin("tags".into()), &[]), &[]), int_val(2));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.Append(ListPolicy.Default, Exp.Val("horror"), Exp.ListBin("tags"))), Exp.Val(2)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListAppend( as.DefaultListPolicy(), as.ExpStringVal("horror"), as.ExpListBin("tags"), ), ), as.ExpIntVal(2),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.lists.append(exp.binList('tags'), exp.str('horror'))), exp.int(2),)as_list_policy pol;as_list_policy_init(&pol);as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_append(NULL, &pol, as_exp_str("horror"), as_exp_bin_list("tags"))), as_exp_int(2)));import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.append(ListPolicy.Default, Exp.val("horror"), Exp.listBin("tags"))), Exp.val(2)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListAppend, ListSize
exp = GT(ListSize(None, ListAppend(None, None, "horror", ListBin("tags"))), 2).compile()list_append_items(context, policy, items, bin)Returns the list with every element of items appended to the end.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
policy | List policy | Write flags for the operation. See Write flags. A violated flag fails the expression, unless |
items | list | Elements to append, as a list. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Size check after appending two strings to tags.
String exp = "$.tags.appendItems(['a', 'b']).count() > 3";exp = "$.tags.appendItems(['a', 'b']).count() > 3"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, list_val};use aerospike::{ListPolicy, Value};
let exp = gt( list_exp::size( list_exp::append_items( ListPolicy::default(), list_val(vec![Value::from("a"), Value::from("b")]), list_bin("tags".into()), &[]), &[]), int_val(3));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.AppendItems( ListPolicy.Default, Exp.Val(new List<string> { "a", "b" }), Exp.ListBin("tags"))), Exp.Val(3)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListAppendItems( as.DefaultListPolicy(), as.ExpListVal(as.NewValue("a"), as.NewValue("b")), as.ExpListBin("tags"), ), ), as.ExpIntVal(3),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.appendItems(exp.binList('tags'), exp.list(['a', 'b'])), ), exp.int(3),)as_list_policy pol;as_list_policy_init(&pol);as_arraylist ab;as_arraylist_init(&ab, 2, 2);as_arraylist_append_str(&ab, "a");as_arraylist_append_str(&ab, "b");as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_append_items( NULL, &pol, as_exp_val(&ab), as_exp_bin_list("tags"))), as_exp_int(3)));as_arraylist_destroy(&ab);import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.appendItems( ListPolicy.Default, Exp.val(java.util.Arrays.asList("a", "b")), Exp.listBin("tags"))), Exp.val(3)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListAppendItems, ListSize
exp = GT(ListSize(None, ListAppendItems(None, None, ["a", "b"], ListBin("tags"))), 3).compile()list_clear(context, bin)Returns the list with all elements removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Cleared list has size 0.
String exp = "$.tags.clear().count() == 0";exp = "$.tags.clear().count() == 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};
let exp = eq(list_exp::size(list_exp::clear(list_bin("tags".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.EQ(ListExp.Size(ListExp.Clear(Exp.ListBin("tags"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListSize(as.ExpListClear(as.ExpListBin("tags"))), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.eq(exp.lists.size(exp.lists.clear(exp.binList('tags'))), exp.int(0))as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_size(NULL, as_exp_list_clear(NULL, as_exp_bin_list("tags"))), as_exp_int(0)));import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq(ListExp.size(ListExp.clear(Exp.listBin("tags"))), Exp.val(0)));from aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListClear, ListSize
exp = Eq(ListSize(None, ListClear(None, ListBin("tags"))), 0).compile()list_increment(context, policy, index, delta, bin)Returns the list with the element at index increased by delta.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
policy | List policy | Write flags for the operation. See Write flags. A violated flag fails the expression, unless |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
delta | integer or float | Amount to add to the element at |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After adding 5 to scores[0], the first element equals 100.
String exp = "($.scores.[0].add(5)).[0] == 100";exp = "($.scores.[0].add(5)).[0] == 100"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{ExpType, eq, int_val, list_bin};use aerospike::{ListPolicy, ListReturnType};
let exp = eq( list_exp::get_by_index( ListReturnType::Values, ExpType::INT, int_val(0), list_exp::increment( ListPolicy::default(), int_val(0), int_val(5), list_bin("scores".into()), &[]), &[]), int_val(100));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), ListExp.Increment(ListPolicy.Default, Exp.Val(0), Exp.Val(5), Exp.ListBin("scores"))), Exp.Val(100)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndex( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListIncrement( as.DefaultListPolicy(), as.ExpIntVal(0), as.ExpIntVal(5), as.ExpListBin("scores"), ), ), as.ExpIntVal(100),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndex( exp.lists.increment(exp.binList('scores'), exp.int(5), exp.int(0)), exp.int(0), exp.type.INT, lists.returnType.VALUE, ), exp.int(100),)as_list_policy pol;as_list_policy_init(&pol);as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index( NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_INT, as_exp_int(0), as_exp_list_increment( NULL, &pol, as_exp_int(0), as_exp_int(5), as_exp_bin_list("scores"))), as_exp_int(100)));import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.val(0), ListExp.increment(ListPolicy.Default, Exp.val(0), Exp.val(5), Exp.listBin("scores"))), Exp.val(100)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBin, ResultTypefrom aerospike_helpers.expressions.list import ListGetByIndex, ListIncrement
exp = Eq( ListGetByIndex( None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 0, ListIncrement(None, None, 0, 5, ListBin("scores")), ), 100,).compile()list_insert(context, policy, index, value, bin)Returns the list with value inserted at index.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
policy | List policy | Write flags for the operation. See Write flags. A violated flag fails the expression, unless |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
value | any | Element to insert at |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Insert prologue at index 0 in tags, then require length > 1.
String exp = "$.tags.[0].insert('prologue').count() > 1";exp = "$.tags.[0].insert('prologue').count() > 1"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, string_val};use aerospike::ListPolicy;
let exp = gt( list_exp::size( list_exp::insert( ListPolicy::default(), int_val(0), string_val("prologue".into()), list_bin("tags".into()), &[]), &[]), int_val(1));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.Insert(ListPolicy.Default, Exp.Val(0), Exp.Val("prologue"), Exp.ListBin("tags"))), Exp.Val(1)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListInsert( as.DefaultListPolicy(), as.ExpIntVal(0), as.ExpStringVal("prologue"), as.ExpListBin("tags"), ), ), as.ExpIntVal(1),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.insert(exp.binList('tags'), exp.str('prologue'), exp.int(0)), ), exp.int(1),)as_list_policy pol;as_list_policy_init(&pol);as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_insert( NULL, &pol, as_exp_int(0), as_exp_str("prologue"), as_exp_bin_list("tags"))), as_exp_int(1)));import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.insert(ListPolicy.Default, Exp.val(0), Exp.val("prologue"), Exp.listBin("tags"))), Exp.val(1)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListInsert, ListSize
exp = GT(ListSize(None, ListInsert(None, None, 0, "prologue", ListBin("tags"))), 1).compile()list_insert_items(context, policy, index, items, bin)Returns the list with every element of items inserted at index.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
policy | List policy | Write flags for the operation. See Write flags. A violated flag fails the expression, unless |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
items | list | Elements to insert at |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Insert [“x”,“y”] at index 1 in tags.
String exp = "$.tags.[1].insertItems(['x', 'y']).count() > 4";exp = "$.tags.[1].insertItems(['x', 'y']).count() > 4"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, list_val};use aerospike::{ListPolicy, Value};
let exp = gt( list_exp::size( list_exp::insert_items( ListPolicy::default(), int_val(1), list_val(vec![Value::from("x"), Value::from("y")]), list_bin("tags".into()), &[]), &[]), int_val(4));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.InsertItems( ListPolicy.Default, Exp.Val(1), Exp.Val(new List<string> { "x", "y" }), Exp.ListBin("tags"))), Exp.Val(4)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListInsertItems( as.DefaultListPolicy(), as.ExpIntVal(1), as.ExpListVal(as.NewValue("x"), as.NewValue("y")), as.ExpListBin("tags"), ), ), as.ExpIntVal(4),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.insertItems( exp.binList('tags'), exp.list(['x', 'y']), exp.int(1), ), ), exp.int(4),)as_list_policy pol;as_list_policy_init(&pol);as_arraylist xy;as_arraylist_init(&xy, 2, 2);as_arraylist_append_str(&xy, "x");as_arraylist_append_str(&xy, "y");as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_insert_items( NULL, &pol, as_exp_int(1), as_exp_val(&xy), as_exp_bin_list("tags"))), as_exp_int(4)));as_arraylist_destroy(&xy);import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.insertItems( ListPolicy.Default, Exp.val(1), Exp.val(java.util.Arrays.asList("x", "y")), Exp.listBin("tags"))), Exp.val(4)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListInsertItems, ListSize
exp = GT( ListSize(None, ListInsertItems(None, None, 1, ["x", "y"], ListBin("tags"))), 4,).compile()list_remove_by_index(context, index, bin)Returns the list with the element at index removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After removing index 0 from tags, length is 2.
String exp = "$.tags.[0].remove().count() == 2";exp = "$.tags.[0].remove().count() == 2"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::size( list_exp::remove_by_index( ListReturnType::None, int_val(0), list_bin("tags".into()), &[]), &[]), int_val(2));Expression exp = Exp.Build( Exp.EQ(ListExp.Size(ListExp.RemoveByIndex(Exp.Val(0), Exp.ListBin("tags"))), Exp.Val(2)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListSize(as.ExpListRemoveByIndex(as.ExpIntVal(0), as.ExpListBin("tags"))), as.ExpIntVal(2),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.eq( exp.lists.size(exp.lists.removeByIndex(exp.binList('tags'), exp.int(0))), exp.int(2),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_size( NULL, as_exp_list_remove_by_index(NULL, as_exp_int(0), as_exp_bin_list("tags"))), as_exp_int(2)));import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.size(ListExp.removeByIndex(Exp.val(0), Exp.listBin("tags"))), Exp.val(2)));from aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByIndex, ListSize
exp = Eq(ListSize(None, ListRemoveByIndex(None, 0, ListBin("tags"))), 2).compile()list_remove_by_index_range(context, index, count, bin)Returns the list with count elements removed, starting at index.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove two elements starting at index 0 from tags.
String exp = "$.tags.[0:2].remove().count() > 0";exp = "$.tags.[0:2].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_index_range_count( ListReturnType::None, int_val(0), int_val(2), list_bin("tags".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByIndexRange( ListReturnType.NONE, Exp.Val(0), Exp.Val(2), Exp.ListBin("tags"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByIndexRangeCount( as.ListReturnTypeNone, as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByIndexRange(exp.binList('tags'), exp.int(2), exp.int(0)), ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_index_range( NULL, AS_LIST_RETURN_NONE, as_exp_int(0), as_exp_int(2), as_exp_bin_list("tags"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByIndexRange( ListReturnType.NONE, Exp.val(0), Exp.val(2), Exp.listBin("tags"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByIndexRange, ListSize
exp = GT(ListSize(None, ListRemoveByIndexRange(None, 0, 2, ListBin("tags"))), 0).compile()list_remove_by_index_range_to_end(context, index, bin)Returns the list with every element from index to the end removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove from index 2 through end of tags; resulting list still has elements.
String exp = "$.tags.[2:].remove().count() > 0";exp = "$.tags.[2:].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_index_range( ListReturnType::None, int_val(2), list_bin("tags".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByIndexRange(ListReturnType.NONE, Exp.Val(2), Exp.ListBin("tags"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByIndexRange( as.ListReturnTypeNone, as.ExpIntVal(2), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.lists.removeByIndexRangeToEnd(exp.binList('tags'), exp.int(2))), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_index_range_to_end( NULL, AS_LIST_RETURN_NONE, as_exp_int(2), as_exp_bin_list("tags"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByIndexRange(ListReturnType.NONE, Exp.val(2), Exp.listBin("tags"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByIndexRangeToEnd, ListSize
exp = GT(ListSize(None, ListRemoveByIndexRangeToEnd(None, 2, ListBin("tags"))), 0).compile()list_remove_by_rank(context, rank, bin)Returns the list with the element of rank rank removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove the smallest score (rank 0) and keep a non-empty list.
String exp = "$.scores.[#0].remove().count() > 0";exp = "$.scores.[#0].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_rank( ListReturnType::None, int_val(0), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size(ListExp.RemoveByRank(Exp.Val(0), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize(as.ExpListRemoveByRank(as.ExpIntVal(0), as.ExpListBin("scores"))), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.lists.removeByRank(exp.binList('scores'), exp.int(0))), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_rank(NULL, as_exp_int(0), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size(ListExp.removeByRank(Exp.val(0), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByRank, ListSize
exp = GT(ListSize(None, ListRemoveByRank(None, 0, ListBin("scores"))), 0).compile()list_remove_by_rank_range(context, rank, count, bin)Returns the list with count elements removed, starting at rank rank.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove the two smallest scores (rank 0, count 2).
String exp = "$.scores.[#0:2].remove().count() > 0";exp = "$.scores.[#0:2].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_rank_range_count( ListReturnType::None, int_val(0), int_val(2), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByRankRange( ListReturnType.NONE, Exp.Val(0), Exp.Val(2), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByRankRangeCount( as.ListReturnTypeNone, as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByRankRange(exp.binList('scores'), exp.int(2), exp.int(0)), ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_rank_range( NULL, AS_LIST_RETURN_NONE, as_exp_int(0), as_exp_int(2), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByRankRange( ListReturnType.NONE, Exp.val(0), Exp.val(2), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByRankRange, ListSize
exp = GT(ListSize(None, ListRemoveByRankRange(None, 0, 2, ListBin("scores"))), 0).compile()list_remove_by_rank_range_to_end(context, rank, bin)Returns the list with every element of rank rank or higher removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove the two largest scores (rank -2 through last).
String exp = "$.scores.[#-2:].remove().count() > 0";exp = "$.scores.[#-2:].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_rank_range( ListReturnType::None, int_val(-2), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByRankRange(ListReturnType.NONE, Exp.Val(-2), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByRankRange( as.ListReturnTypeNone, as.ExpIntVal(-2), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.lists.removeByRankRangeToEnd(exp.binList('scores'), exp.int(-2))), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_rank_range_to_end( NULL, AS_LIST_RETURN_NONE, as_exp_int(-2), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByRankRange(ListReturnType.NONE, Exp.val(-2), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByRankRangeToEnd, ListSize
exp = GT(ListSize(None, ListRemoveByRankRangeToEnd(None, -2, ListBin("scores"))), 0).compile()list_remove_by_rel_rank_range(context, value, rank, count, bin)Returns the list with count elements removed, starting at the rank rank places from value.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
value | any | Value that |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove at most two elements relative to value 10 (rank offset 0) in scores.
String exp = "$.scores.[#0:1~10].remove().count() > 0";exp = "$.scores.[#0:1~10].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_value_relative_rank_range_count( ListReturnType::None, int_val(10), int_val(0), int_val(2), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValueRelativeRankRange( ListReturnType.NONE, Exp.Val(10), Exp.Val(0), Exp.Val(2), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRelativeRankRangeCount( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByRelRankRange( exp.binList('scores'), exp.int(2), exp.int(0), exp.int(10), ), ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_rel_rank_range( NULL, AS_LIST_RETURN_NONE, as_exp_int(10), as_exp_int(0), as_exp_int(2), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByValueRelativeRankRange( ListReturnType.NONE, Exp.val(10), Exp.val(0), Exp.val(2), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByValueRelRankRange, ListSize
exp = GT( ListSize(None, ListRemoveByValueRelRankRange(None, 10, 0, 2, ListBin("scores"))), 0,).compile()list_remove_by_rel_rank_range_to_end(context, value, rank, bin)Returns the list with every element from the rank rank places from value to the highest rank removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
value | any | Value that |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove by relative rank from value 10, rank offset 0, through end of scores.
String exp = "$.scores.[#0:~10].remove().count() > 0";exp = "$.scores.[#0:~10].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_value_relative_rank_range( ListReturnType::None, int_val(10), int_val(0), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValueRelativeRankRange( ListReturnType.NONE, Exp.Val(10), Exp.Val(0), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRelativeRankRange( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(0), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByRelRankRangeToEnd(exp.binList('scores'), exp.int(0), exp.int(10)), ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_rel_rank_range_to_end( NULL, AS_LIST_RETURN_NONE, as_exp_int(10), as_exp_int(0), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByValueRelativeRankRange( ListReturnType.NONE, Exp.val(10), Exp.val(0), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByValueRelRankToEnd, ListSize
exp = GT( ListSize(None, ListRemoveByValueRelRankToEnd(None, 10, 0, ListBin("scores"))), 0,).compile()list_remove_by_value(context, value, bin)Returns the list with every element equal to value removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
value | any | Value to match. Every element equal to it is removed. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After removing draft from tags, the list is still non-empty.
String exp = "$.tags.[='draft'].remove().count() > 0";exp = "$.tags.[='draft'].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, string_val};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_value( ListReturnType::None, string_val("draft".into()), list_bin("tags".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValue(ListReturnType.NONE, Exp.Val("draft"), Exp.ListBin("tags"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValue( as.ListReturnTypeNone, as.ExpStringVal("draft"), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.lists.removeByValue(exp.binList('tags'), exp.str('draft'))), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_value( NULL, AS_LIST_RETURN_NONE, as_exp_str("draft"), as_exp_bin_list("tags"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByValue(ListReturnType.NONE, Exp.val("draft"), Exp.listBin("tags"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByValue, ListSize
exp = GT(ListSize(None, ListRemoveByValue(None, "draft", ListBin("tags"))), 0).compile()list_remove_by_value_list(context, values, bin)Returns the list with every element matching one of values removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
values | list | Values to match. Any element equal to one of these is removed. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After removing values a and b from tags, size remains > 0.
String exp = "$.tags.[='a', 'b'].remove().count() > 0";exp = "$.tags.[='a', 'b'].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, list_val};use aerospike::{ListReturnType, Value};
let exp = gt( list_exp::size( list_exp::remove_by_value_list( ListReturnType::None, list_val(vec![Value::from("a"), Value::from("b")]), list_bin("tags".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValueList( ListReturnType.NONE, Exp.Val(new List<string> { "a", "b" }), Exp.ListBin("tags"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueList( as.ListReturnTypeNone, as.ExpListVal(as.NewValue("a"), as.NewValue("b")), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByValueList(exp.binList('tags'), exp.list(['a', 'b'])), ), exp.int(0),)as_arraylist rm;as_arraylist_init(&rm, 2, 2);as_arraylist_append_str(&rm, "a");as_arraylist_append_str(&rm, "b");as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_value_list( NULL, AS_LIST_RETURN_NONE, as_exp_val(&rm), as_exp_bin_list("tags"))), as_exp_int(0)));as_arraylist_destroy(&rm);import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByValueList( ListReturnType.NONE, Exp.val(java.util.Arrays.asList("a", "b")), Exp.listBin("tags"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByValueList, ListSize
exp = GT(ListSize(None, ListRemoveByValueList(None, ["a", "b"], ListBin("tags"))), 0).compile()list_remove_by_value_range(context, value_begin, value_end, bin)Returns the list with every element in the interval value_begin ≤ x < value_end removed.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
value_begin | any | Lowest value to match, inclusive. |
value_end | any | Upper bound on the value, exclusive. Omit it to match everything from |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list Remove integer scores in [10, 20) and check the modified list still has elements.
String exp = "$.scores.[=10:20].remove().count() > 0";exp = "$.scores.[=10:20].remove().count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::size( list_exp::remove_by_value_range( ListReturnType::None, Some(int_val(10)), Some(int_val(20)), list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValueRange( ListReturnType.NONE, Exp.Val(10), Exp.Val(20), Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRange( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(20), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size( exp.lists.removeByValueRange(exp.binList('scores'), exp.int(20), exp.int(10)), ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size( NULL, as_exp_list_remove_by_value_range( NULL, AS_LIST_RETURN_NONE, as_exp_int(10), as_exp_int(20), as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.size( ListExp.removeByValueRange( ListReturnType.NONE, Exp.val(10), Exp.val(20), Exp.listBin("scores"))), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListRemoveByValueRange, ListSize
exp = GT(ListSize(None, ListRemoveByValueRange(None, 10, 20, ListBin("scores"))), 0).compile()list_set(context, index, value, bin)Returns the list with the element at index replaced by value.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
value | any | Element to write at |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After setting scores[1] to 99, read back 99 at index 1.
String exp = "($.scores.[1].setTo(99)).[1] == 99";exp = "($.scores.[1].setTo(99)).[1] == 99"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{ExpType, eq, int_val, list_bin};use aerospike::{ListPolicy, ListReturnType};
let exp = eq( list_exp::get_by_index( ListReturnType::Values, ExpType::INT, int_val(1), list_exp::set( ListPolicy::default(), int_val(1), int_val(99), list_bin("scores".into()), &[]), &[]), int_val(99));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(1), ListExp.Set(ListPolicy.Default, Exp.Val(1), Exp.Val(99), Exp.ListBin("scores"))), Exp.Val(99)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndex( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(1), as.ExpListSet( as.DefaultListPolicy(), as.ExpIntVal(1), as.ExpIntVal(99), as.ExpListBin("scores"), ), ), as.ExpIntVal(99),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndex( exp.lists.set(exp.binList('scores'), exp.int(99), exp.int(1)), exp.int(1), exp.type.INT, lists.returnType.VALUE, ), exp.int(99),)as_list_policy pol;as_list_policy_init(&pol);as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index( NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_INT, as_exp_int(1), as_exp_list_set( NULL, &pol, as_exp_int(1), as_exp_int(99), as_exp_bin_list("scores"))), as_exp_int(99)));import com.aerospike.client.cdt.ListPolicy;import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.val(1), ListExp.set(ListPolicy.Default, Exp.val(1), Exp.val(99), Exp.listBin("scores"))), Exp.val(99)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBin, ResultTypefrom aerospike_helpers.expressions.list import ListGetByIndex, ListSet
exp = Eq( ListGetByIndex( None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 1, ListSet(None, None, 1, 99, ListBin("scores")), ), 99,).compile()list_sort(context, sort_flags, bin)Returns the list in sorted order, as directed by sort_flags.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
sort_flags | integer literal | Sort flags: |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
list After the default ascending sort, the first element of scores is 0.
String exp = "($.scores.sort()).[0] == 0";exp = "($.scores.sort()).[0] == 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{ExpType, eq, int_val, list_bin};use aerospike::{ListReturnType, ListSortFlags};
let exp = eq( list_exp::get_by_index( ListReturnType::Values, ExpType::INT, int_val(0), list_exp::sort(ListSortFlags::Default, list_bin("scores".into()), &[]), &[]), int_val(0));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), ListExp.Sort(ListSortFlags.DEFAULT, Exp.ListBin("scores"))), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndex( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListSort(as.ListSortFlagsDefault, as.ExpListBin("scores")), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndex( exp.lists.sort(exp.binList('scores'), lists.sortFlags.DEFAULT), exp.int(0), exp.type.INT, lists.returnType.VALUE, ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index( NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_INT, as_exp_int(0), as_exp_list_sort(NULL, AS_LIST_SORT_DEFAULT, as_exp_bin_list("scores"))), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.cdt.ListSortFlags;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.val(0), ListExp.sort(ListSortFlags.DEFAULT, Exp.listBin("scores"))), Exp.val(0)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBin, ResultTypefrom aerospike_helpers.expressions.list import ListGetByIndex, ListSort
exp = Eq( ListGetByIndex( None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 0, ListSort(None, aerospike.LIST_SORT_DEFAULT, ListBin("scores")), ), 0,).compile()Read
list_get_by_index(type, context, result_type, index, bin)Returns the element at index.
| Name | Type | Description |
|---|---|---|
type | integer literal | Data type of the element being read. Expressions are strictly typed, so this getter declares the type it evaluates to; an element of another type fails the expression. |
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any First element of integer list scores equals 42 (LIST_RETURN_VALUE with integer value type).
String exp = "$.scores.[0] == 42";exp = "$.scores.[0] == 42"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{ExpType, eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_index( ListReturnType::Values, ExpType::INT, int_val(0), list_bin("scores".into()), &[]), int_val(42));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), Exp.ListBin("scores")), Exp.Val(42)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndex( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(42),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndex( exp.binList('scores'), exp.int(0), exp.type.INT, lists.returnType.VALUE, ), exp.int(42),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index( NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_INT, as_exp_int(0), as_exp_bin_list("scores")), as_exp_int(42)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.val(0), Exp.listBin("scores")), Exp.val(42)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBin, ResultTypefrom aerospike_helpers.expressions.list import ListGetByIndex
exp = Eq( ListGetByIndex(None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 0, ListBin("scores")), 42,).compile()list_get_by_index_range(context, result_type, index, count, bin)Returns count elements starting at index.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Exactly two elements starting at index 1 in scores (LIST_RETURN_COUNT with index 1 and count 2).
String exp = "$.scores.[1:3].count() == 2";exp = "$.scores.[1:3].count() == 2"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_index_range_count( ListReturnType::Count, int_val(1), int_val(2), list_bin("scores".into()), &[]), int_val(2));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndexRange( ListReturnType.COUNT, Exp.Val(1), Exp.Val(2), Exp.ListBin("scores")), Exp.Val(2)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndexRangeCount( as.ListReturnTypeCount, as.ExpIntVal(1), as.ExpIntVal(2), as.ExpListBin("scores"), ), as.ExpIntVal(2),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndexRange( exp.binList('scores'), exp.int(1), exp.int(2), lists.returnType.COUNT, ), exp.int(2),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index_range( NULL, AS_LIST_RETURN_COUNT, as_exp_int(1), as_exp_int(2), as_exp_bin_list("scores")), as_exp_int(2)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndexRange( ListReturnType.COUNT, Exp.val(1), Exp.val(2), Exp.listBin("scores")), Exp.val(2)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListGetByIndexRange
exp = Eq( ListGetByIndexRange(None, aerospike.LIST_RETURN_COUNT, 1, 2, ListBin("scores")), 2,).compile()list_get_by_index_range_to_end(context, result_type, index, bin)Returns every element from index to the end.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
index | integer | Zero-based position in the collection, 0 being the first element. A negative index counts back from the end. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Count of elements from index 2 through the end of tags (LIST_RETURN_COUNT).
String exp = "$.tags.[2:].count() == 1";exp = "$.tags.[2:].count() == 1"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_index_range( ListReturnType::Count, int_val(2), list_bin("tags".into()), &[]), int_val(1));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndexRange(ListReturnType.COUNT, Exp.Val(2), Exp.ListBin("tags")), Exp.Val(1)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByIndexRange( as.ListReturnTypeCount, as.ExpIntVal(2), as.ExpListBin("tags"), ), as.ExpIntVal(1),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByIndexRangeToEnd( exp.binList('tags'), exp.int(2), lists.returnType.COUNT, ), exp.int(1),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_index_range_to_end( NULL, AS_LIST_RETURN_COUNT, as_exp_int(2), as_exp_bin_list("tags")), as_exp_int(1)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByIndexRange(ListReturnType.COUNT, Exp.val(2), Exp.listBin("tags")), Exp.val(1)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListGetByIndexRangeToEnd
exp = Eq( ListGetByIndexRangeToEnd(None, aerospike.LIST_RETURN_COUNT, 2, ListBin("tags")), 1,).compile()list_get_by_rank(type, context, result_type, rank, bin)Returns the element of rank rank.
| Name | Type | Description |
|---|---|---|
type | integer literal | Data type of the element being read. Expressions are strictly typed, so this getter declares the type it evaluates to; an element of another type fails the expression. |
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Smallest value in integer list scores is 12 (rank 0, LIST_RETURN_VALUE).
String exp = "$.scores.[#0] == 12";exp = "$.scores.[#0] == 12"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{ExpType, eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_rank( ListReturnType::Values, ExpType::INT, int_val(0), list_bin("scores".into()), &[]), int_val(12));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRank(ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), Exp.ListBin("scores")), Exp.Val(12)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByRank( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(12),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByRank( exp.binList('scores'), exp.int(0), exp.type.INT, lists.returnType.VALUE, ), exp.int(12),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_rank( NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_INT, as_exp_int(0), as_exp_bin_list("scores")), as_exp_int(12)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByRank(ListReturnType.VALUE, Exp.Type.INT, Exp.val(0), Exp.listBin("scores")), Exp.val(12)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBin, ResultTypefrom aerospike_helpers.expressions.list import ListGetByRank
exp = Eq( ListGetByRank(None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 0, ListBin("scores")), 12,).compile()list_get_by_rank_range(context, result_type, rank, count, bin)Returns count elements starting at rank rank.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Three smallest values in scores (rank 0, count 3, LIST_RETURN_COUNT).
String exp = "$.scores.[#0:3].count() == 3";exp = "$.scores.[#0:3].count() == 3"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_rank_range_count( ListReturnType::Count, int_val(0), int_val(3), list_bin("scores".into()), &[]), int_val(3));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRankRange( ListReturnType.COUNT, Exp.Val(0), Exp.Val(3), Exp.ListBin("scores")), Exp.Val(3)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByRankRangeCount( as.ListReturnTypeCount, as.ExpIntVal(0), as.ExpIntVal(3), as.ExpListBin("scores"), ), as.ExpIntVal(3),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByRankRange( exp.binList('scores'), exp.int(0), exp.int(3), lists.returnType.COUNT, ), exp.int(3),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_rank_range( NULL, AS_LIST_RETURN_COUNT, as_exp_int(0), as_exp_int(3), as_exp_bin_list("scores")), as_exp_int(3)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByRankRange( ListReturnType.COUNT, Exp.val(0), Exp.val(3), Exp.listBin("scores")), Exp.val(3)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListGetByRankRange
exp = Eq( ListGetByRankRange(None, aerospike.LIST_RETURN_COUNT, 0, 3, ListBin("scores")), 3,).compile()list_get_by_rank_range_to_end(context, result_type, rank, bin)Returns every element of rank rank or higher.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Two largest values in scores (rank -2 through last, LIST_RETURN_COUNT).
String exp = "$.scores.[#-2:].count() == 2";exp = "$.scores.[#-2:].count() == 2"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, int_val, list_bin};use aerospike::ListReturnType;
let exp = eq( list_exp::get_by_rank_range( ListReturnType::Count, int_val(-2), list_bin("scores".into()), &[]), int_val(2));Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRankRange(ListReturnType.COUNT, Exp.Val(-2), Exp.ListBin("scores")), Exp.Val(2)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListGetByRankRange( as.ListReturnTypeCount, as.ExpIntVal(-2), as.ExpListBin("scores"), ), as.ExpIntVal(2),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByRankRangeToEnd( exp.binList('scores'), exp.int(-2), lists.returnType.COUNT, ), exp.int(2),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_rank_range_to_end( NULL, AS_LIST_RETURN_COUNT, as_exp_int(-2), as_exp_bin_list("scores")), as_exp_int(2)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.getByRankRange(ListReturnType.COUNT, Exp.val(-2), Exp.listBin("scores")), Exp.val(2)));import aerospikefrom aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListGetByRankRangeToEnd
exp = Eq( ListGetByRankRangeToEnd(None, aerospike.LIST_RETURN_COUNT, -2, ListBin("scores")), 2,).compile()list_get_by_rel_rank_range(context, result_type, value, rank, count, bin)Returns count elements starting at the rank rank places from value.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
value | any | Value that |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
count | integer | Number of elements in the range. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Count of elements selected by relative rank range from value 15 (rank offset 0, max 3 items) in scores.
String exp = "$.scores.[#0:2~15].count() > 0";exp = "$.scores.[#0:2~15].count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::get_by_value_relative_rank_range_count( ListReturnType::Count, int_val(15), int_val(0), int_val(3), list_bin("scores".into()), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueRelativeRankRange( ListReturnType.COUNT, Exp.Val(15), Exp.Val(0), Exp.Val(3), Exp.ListBin("scores")), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListGetByValueRelativeRankRangeCount( as.ListReturnTypeCount, as.ExpIntVal(15), as.ExpIntVal(0), as.ExpIntVal(3), as.ExpListBin("scores"), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.gt( exp.lists.getByRelRankRange( exp.binList('scores'), exp.int(15), exp.int(0), exp.int(3), lists.returnType.COUNT, ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_get_by_rel_rank_range( NULL, AS_LIST_RETURN_COUNT, as_exp_int(15), as_exp_int(0), as_exp_int(3), as_exp_bin_list("scores")), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.getByValueRelativeRankRange( ListReturnType.COUNT, Exp.val(15), Exp.val(0), Exp.val(3), Exp.listBin("scores")), Exp.val(0)));import aerospikefrom aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListGetByValueRelRankRange
exp = GT( ListGetByValueRelRankRange( None, aerospike.LIST_RETURN_COUNT, 15, 0, 3, ListBin("scores") ), 0,).compile()list_get_by_rel_rank_range_to_end(context, result_type, value, rank, bin)Returns every element from the rank rank places from value to the highest rank.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
value | any | Value that |
rank | integer | Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Relative rank range from value 15 with rank offset 0 through end of scores (LIST_RETURN_COUNT > 0).
String exp = "$.scores.[#0:~15].count() > 0";exp = "$.scores.[#0:~15].count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::get_by_value_relative_rank_range( ListReturnType::Count, int_val(15), int_val(0), list_bin("scores".into()), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueRelativeRankRange( ListReturnType.COUNT, Exp.Val(15), Exp.Val(0), Exp.ListBin("scores")), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListGetByValueRelativeRankRange( as.ListReturnTypeCount, as.ExpIntVal(15), as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.gt( exp.lists.getByRelRankRangeToEnd( exp.binList('scores'), exp.int(15), exp.int(0), lists.returnType.COUNT, ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_get_by_rel_rank_range_to_end( NULL, AS_LIST_RETURN_COUNT, as_exp_int(15), as_exp_int(0), as_exp_bin_list("scores")), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.getByValueRelativeRankRange( ListReturnType.COUNT, Exp.val(15), Exp.val(0), Exp.listBin("scores")), Exp.val(0)));import aerospikefrom aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListGetByValueRelRankRangeToEnd
exp = GT( ListGetByValueRelRankRangeToEnd( None, aerospike.LIST_RETURN_COUNT, 15, 0, ListBin("scores") ), 0,).compile()list_get_by_value(context, result_type, value, bin)Returns every element equal to value.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
value | any | Value to match. Every element equal to it is selected. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Filter where string list bin tags contains the value fiction, using LIST_RETURN_EXISTS (see also the path expressions IN-list membership pattern).
String exp = "$.tags.[='fiction'].exists()";exp = "$.tags.[='fiction'].exists()"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{list_bin, string_val};use aerospike::ListReturnType;
let exp = list_exp::get_by_value( ListReturnType::Exists, string_val("fiction".into()), list_bin("tags".into()), &[]);Expression exp = Exp.Build( ListExp.GetByValue(ListReturnType.EXISTS, Exp.Val("fiction"), Exp.ListBin("tags")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpListGetByValue( as.ListReturnTypeExists, as.ExpStringVal("fiction"), as.ExpListBin("tags"),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.lists.getByValue( exp.binList('tags'), exp.str('fiction'), lists.returnType.EXISTS,)as_exp_build(predexp, as_exp_list_get_by_value( NULL, AS_LIST_RETURN_EXISTS, as_exp_str("fiction"), as_exp_bin_list("tags")));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( ListExp.getByValue(ListReturnType.EXISTS, Exp.val("fiction"), Exp.listBin("tags")));import aerospikefrom aerospike_helpers.expressions import ListBinfrom aerospike_helpers.expressions.list import ListGetByValue
exp = ListGetByValue( None, aerospike.LIST_RETURN_EXISTS, "fiction", ListBin("tags")).compile()list_get_by_value_list(context, result_type, values, bin)Returns every element matching one of values.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
values | list | Values to match, as a list. Every element equal to any of them is selected. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Integer scores in scores where at least one value matches the list [88, 94] (using LIST_RETURN_COUNT > 0).
String exp = "$.scores.[=88, 94].count() > 0";exp = "$.scores.[=88, 94].count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin, list_val};use aerospike::{ListReturnType, Value};
let exp = gt( list_exp::get_by_value_list( ListReturnType::Count, list_val(vec![Value::from(88), Value::from(94)]), list_bin("scores".into()), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueList( ListReturnType.COUNT, Exp.Val(new List<int> { 88, 94 }), Exp.ListBin("scores")), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListGetByValueList( as.ListReturnTypeCount, as.ExpListVal(as.NewValue(88), as.NewValue(94)), as.ExpListBin("scores"), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.gt( exp.lists.getByValueList( exp.binList('scores'), exp.list([88, 94]), lists.returnType.COUNT, ), exp.int(0),)as_arraylist vl;as_arraylist_init(&vl, 2, 2);as_arraylist_append_int64(&vl, 88);as_arraylist_append_int64(&vl, 94);as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_get_by_value_list( NULL, AS_LIST_RETURN_COUNT, as_exp_val(&vl), as_exp_bin_list("scores")), as_exp_int(0)));as_arraylist_destroy(&vl);import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.getByValueList( ListReturnType.COUNT, Exp.val(java.util.Arrays.asList(88, 94)), Exp.listBin("scores")), Exp.val(0)));import aerospikefrom aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListGetByValueList
exp = GT( ListGetByValueList(None, aerospike.LIST_RETURN_COUNT, [88, 94], ListBin("scores")), 0,).compile()list_get_by_value_range(context, result_type, value_begin, value_end, bin)Returns every element in the interval value_begin ≤ x < value_end.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
result_type | integer literal | Which form the result takes, such as count, index, rank, or value. See Return types. |
value_begin | any | Lowest value to match, inclusive. |
value_end | any | Upper bound on the value, exclusive. Omit it to match everything from |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
any Integer list scores with values in the half-open interval [10, 50) (using LIST_RETURN_COUNT).
String exp = "$.scores.[=10:50].count() > 0";exp = "$.scores.[=10:50].count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};use aerospike::ListReturnType;
let exp = gt( list_exp::get_by_value_range( ListReturnType::Count, Some(int_val(10)), Some(int_val(50)), list_bin("scores".into()), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueRange( ListReturnType.COUNT, Exp.Val(10), Exp.Val(50), Exp.ListBin("scores")), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListGetByValueRange( as.ListReturnTypeCount, as.ExpIntVal(10), as.ExpIntVal(50), as.ExpListBin("scores"), ), as.ExpIntVal(0),)const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.gt( exp.lists.getByValueRange( exp.binList('scores'), exp.int(10), exp.int(50), lists.returnType.COUNT, ), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_get_by_value_range( NULL, AS_LIST_RETURN_COUNT, as_exp_int(10), as_exp_int(50), as_exp_bin_list("scores")), as_exp_int(0)));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt( ListExp.getByValueRange( ListReturnType.COUNT, Exp.val(10), Exp.val(50), Exp.listBin("scores")), Exp.val(0)));import aerospikefrom aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListGetByValueRange
exp = GT( ListGetByValueRange(None, aerospike.LIST_RETURN_COUNT, 10, 50, ListBin("scores")), 0,).compile()list_join(context, separator, bin)Returns the list’s string elements joined into one string. Every client also exposes a form that takes no separator, concatenating the elements with nothing between them.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
separator | string | String placed between elements. Omit it to join them with nothing in between. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
string Filter records whose list bin tags, joined with ,, equals red,green,blue.
String exp = "$.tags.join(',') == 'red,green,blue'";exp = "$.tags.join(',') == 'red,green,blue'"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{eq, list_bin, string_val};
let exp = eq( list_exp::join_by_separator( string_val(",".into()), list_bin("tags".into()), &[]), string_val("red,green,blue".into()));Expression exp = Exp.Build( Exp.EQ( ListExp.Join(Exp.Val(","), Exp.ListBin("tags")), Exp.Val("red,green,blue")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpEq( as.ExpListJoinBySeparator(as.ExpStringVal(","), as.ExpListBin("tags")), as.ExpStringVal("red,green,blue"),)const Aerospike = require('aerospike')const exp = Aerospike.exp
const filterExp = exp.eq( exp.lists.joinSeparator(exp.binList('tags'), ','), exp.str('red,green,blue'),)as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_join_separator(NULL, ",", as_exp_bin_list("tags")), as_exp_str("red,green,blue")));import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.eq( ListExp.join(Exp.val(","), Exp.listBin("tags")), Exp.val("red,green,blue")));from aerospike_helpers.expressions import Eq, ListBinfrom aerospike_helpers.expressions.list import ListJoin
exp = Eq(ListJoin(None, ",", ListBin("tags")), "red,green,blue").compile()list_size(context, bin)Returns the number of elements in the list.
| Name | Type | Description |
|---|---|---|
context | Context instance | Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level. |
bin | list | List bin to operate on, or any expression that evaluates to a list. |
integer Filter records whose list bin tags is non-empty (same pattern as bin_list with size).
String exp = "$.tags:LIST.count() > 0";exp = "$.tags:LIST.count() > 0"use aerospike::expressions::lists as list_exp;use aerospike::expressions::{gt, int_val, list_bin};
let exp = gt(list_exp::size(list_bin("tags".into()), &[]), int_val(0));Expression exp = Exp.Build( Exp.GT(ListExp.Size(Exp.ListBin("tags")), Exp.Val(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpGreater( as.ExpListSize(as.ExpListBin("tags")), as.ExpIntVal(0),)const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.binList('tags')), exp.int(0),)as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size(NULL, as_exp_bin_list("tags")), as_exp_int(0)));import com.aerospike.client.exp.Expression;import com.aerospike.client.exp.Exp;import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build( Exp.gt(ListExp.size(Exp.listBin("tags")), Exp.val(0)));from aerospike_helpers.expressions import GT, ListBinfrom aerospike_helpers.expressions.list import ListSize
exp = GT(ListSize(None, ListBin("tags")), 0).compile()