List bin operations
Aerospike list bin expressions read and modify list-type bins inside filter, operation, and projection pipelines. Use them with comparison and logic expressions when you need a boolean filter, or compose them with record storage typed-bin readers (bin_list) when you need the list value first.
In each operation, the list operand (list_bin_expr in the argument tables) is any list-valued expression: not only a named list bin, but also the result of another expression that evaluates to a list. List operations compose by passing those values as the list input—for example, taking the size of a list after an append. For nested collection data and path filters, see Querying collection data types and Path expressions.
Composing expressions
The list_append reference includes an Example that wraps ListExp.append in ListExp.size—the same modify-then-read pattern described above. Many other modify operations show similar composition: their examples nest another list expression as the list operand (list_bin_expr in the arguments table).
This reference covers read operations (size, get-by-index, get-by-value, rank and range variants) and modify operations (append, insert, remove, set, increment, sort, and clear). List modify expressions evaluate on a temporary list value; they do not persist unless used in a write pipeline that stores the result.
-
List modify expressions differ from CDT List operations in that they return the modified list-bin instead of a specified return type (for remove-by ops) or predefined return type (The CDT operation
appendreturns an int for example). -
List read expressions (other than
LIST_SIZE) return a result based on theirinteger_valueparameter.Calling single result CDT operations (e.g.
LIST_GET_BY_INDEX) requires aninteger_valuewheninteger_valueisLIST_RETURN_VALUEbecause a list element value can be any expression type.
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 ListExp.getByValue 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.
Modify
list_append(context, policy, value, bin)Append value to list bin. list_append does not create a new bin if the specified bin does not exist, unlike the append CDT List operation, which does create a new bin if the specified bin does not exist.
| Name | Type |
|---|---|
context | library_specific |
policy | library_specific |
value | expr |
bin | list_bin_expr |
list_bin Hypothetical filter using the list after appending horror to tags (modify expressions evaluate on a temporary list value).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListAppend( as.DefaultListPolicy(), as.ExpStringVal("horror"), as.ExpListBin("tags"), ), ), as.ExpIntVal(2),)Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.Append(ListPolicy.Default, Exp.Val("horror"), Exp.ListBin("tags"))), Exp.Val(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),)list_append_items(context, policy, values, bin)Append all elements in values to list bin.
| Name | Type |
|---|---|
context | library_specific |
policy | library_specific |
values | list_expr |
bin | list_bin_expr |
list_bin Size check after appending two strings to tags.
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()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);// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListAppendItems( as.DefaultListPolicy(), as.ExpListVal(as.NewValue("a"), as.NewValue("b")), as.ExpListBin("tags"), ), ), as.ExpIntVal(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)));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),)list_clear(context, bin)Clear all elements in list bin.
| Name | Type |
|---|---|
context | library_specific |
bin | list_bin_expr |
list_bin Cleared list has size 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListSize(as.ExpListClear(as.ExpListBin("tags"))), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.EQ(ListExp.Size(ListExp.Clear(Exp.ListBin("tags"))), Exp.Val(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))list_increment(context, policy, index, delta, bin)Increment element at index by delta.
| Name | Type |
|---|---|
context | library_specific |
policy | library_specific |
index | integer_expr |
delta | integer_expr |
bin | list_bin_expr |
list_bin After adding 5 to scores[0], the first element equals 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = 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),)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)));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),)list_insert(context, policy, index, value, bin)Insert value at index.
| Name | Type |
|---|---|
context | library_specific |
policy | library_specific |
index | integer_expr |
value | expr |
bin | list_bin_expr |
list_bin Insert prologue at index 0 in tags, then require length > 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListInsert( as.DefaultListPolicy(), as.ExpIntVal(0), as.ExpStringVal("prologue"), as.ExpListBin("tags"), ), ), as.ExpIntVal(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)));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),)list_insert_items(context, policy, index, values, bin)Insert all elements in values at index.
| Name | Type |
|---|---|
context | library_specific |
policy | library_specific |
index | integer_expr |
values | list_expr |
bin | list_bin_expr |
list_bin Insert [“x”,“y”] at index 1 in tags.
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()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);// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = 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),)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)));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),)list_remove_by_index(context, index, bin)Remove element at index.
| Name | Type |
|---|---|
context | library_specific |
index | integer_expr |
bin | list_bin_expr |
list_bin After removing index 0 from tags, length is 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListSize(as.ExpListRemoveByIndex(as.ExpIntVal(0), as.ExpListBin("tags"))), as.ExpIntVal(2),)Expression exp = Exp.Build( Exp.EQ(ListExp.Size(ListExp.RemoveByIndex(Exp.Val(0), Exp.ListBin("tags"))), Exp.Val(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),)list_remove_by_index_range(context, index, count, bin)Remove count element at index.
| Name | Type |
|---|---|
context | library_specific |
index | integer_expr |
count | integer_expr |
bin | list_bin_expr |
list_bin Remove two elements starting at index 0 from 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( 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByIndexRangeCount( as.ListReturnTypeNone, as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("tags"), ), ), as.ExpIntVal(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)));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),)list_remove_by_index_range_to_end(context, index, bin)Remove all elements at and after index.
| Name | Type |
|---|---|
context | library_specific |
index | integer_expr |
bin | list_bin_expr |
list_bin Remove from index 2 through end of tags; resulting list still has elements.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByIndexRange( as.ListReturnTypeNone, as.ExpIntVal(2), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByIndexRange(ListReturnType.NONE, Exp.Val(2), Exp.ListBin("tags"))), Exp.Val(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),)list_remove_by_rank(context, rank, bin)Remove all element with rank rank.
| Name | Type |
|---|---|
context | library_specific |
rank | integer_expr |
bin | list_bin_expr |
list_bin Remove the smallest score (rank 0) and keep a non-empty list.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize(as.ExpListRemoveByRank(as.ExpIntVal(0), as.ExpListBin("scores"))), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.Size(ListExp.RemoveByRank(Exp.Val(0), Exp.ListBin("scores"))), Exp.Val(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),)list_remove_by_rank_range(context, rank, count, bin)Remove count element at rank.
| Name | Type |
|---|---|
context | library_specific |
rank | integer_expr |
count | integer_expr |
bin | list_bin_expr |
list_bin Remove the two smallest scores (rank 0, count 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.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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByRankRangeCount( as.ListReturnTypeNone, as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("scores"), ), ), as.ExpIntVal(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)));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),)list_remove_by_rank_range_to_end(context, rank, bin)Remove all elements at and after rank.
| Name | Type |
|---|---|
context | library_specific |
rank | integer_expr |
bin | list_bin_expr |
list_bin Remove the two largest scores (rank -2 through last).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByRankRange( as.ListReturnTypeNone, as.ExpIntVal(-2), as.ExpListBin("scores"), ), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByRankRange(ListReturnType.NONE, Exp.Val(-2), Exp.ListBin("scores"))), Exp.Val(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),)list_remove_by_rel_rank_range(context, value, rank, count, bin)Remove count element at rank relative to value.
| Name | Type |
|---|---|
context | library_specific |
value | expr |
rank | integer_expr |
count | integer_expr |
bin | list_bin_expr |
list_bin Remove at most two elements relative to value 10 (rank offset 0) in scores.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRelativeRankRangeCount( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(0), as.ExpIntVal(2), as.ExpListBin("scores"), ), ), as.ExpIntVal(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)));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),)list_remove_by_rel_rank_range_to_end(context, value, rank, bin)Remove all elements at and after rank relative to value.
| Name | Type |
|---|---|
context | library_specific |
value | expr |
rank | integer_expr |
bin | list_bin_expr |
list_bin Remove by relative rank from value 10, rank offset 0, through end of scores.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRelativeRankRange( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(0), as.ExpListBin("scores"), ), ), as.ExpIntVal(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)));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),)list_remove_by_value(context, value, bin)Remove all value values from list.
| Name | Type |
|---|---|
context | library_specific |
value | expr |
bin | list_bin_expr |
list_bin After removing draft from tags, the list is still non-empty.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValue( as.ListReturnTypeNone, as.ExpStringVal("draft"), as.ExpListBin("tags"), ), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.Size( ListExp.RemoveByValue(ListReturnType.NONE, Exp.Val("draft"), Exp.ListBin("tags"))), Exp.Val(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),)list_remove_by_value_list(context, value, bin)Remove all elements with values in value_list from list.
| Name | Type |
|---|---|
context | library_specific |
value | list_expr |
bin | list_bin_expr |
list_bin After removing values a and b from tags, size remains > 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.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()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);// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueList( as.ListReturnTypeNone, as.ExpListVal(as.NewValue("a"), as.NewValue("b")), as.ExpListBin("tags"), ), ), as.ExpIntVal(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)));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),)list_remove_by_value_range(context, start, end, bin)Remove all elements x in interval start ≤ x < end from list.
| Name | Type |
|---|---|
context | library_specific |
start | expr |
end | expr |
bin | list_bin_expr |
list_bin Remove integer scores in [10, 20) and check the modified list still has elements.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize( as.ExpListRemoveByValueRange( as.ListReturnTypeNone, as.ExpIntVal(10), as.ExpIntVal(20), as.ExpListBin("scores"), ), ), as.ExpIntVal(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)));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),)list_set(context, index, value, bin)Set element at index to value.
| Name | Type |
|---|---|
context | library_specific |
index | integer-expr |
value | expr |
bin | list_bin_expr |
list_bin After setting scores[1] to 99, read back 99 at index 1.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = 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),)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)));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),)list_sort(context, flag, bin)Sort list.
| Name | Type |
|---|---|
context | library_specific |
flag | integer |
bin | list_bin_expr |
list_bin After default ascending sort, the smallest element in scores is 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.getByRank( 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 ListGetByRank, ListSort
exp = Eq( ListGetByRank( None, aerospike.LIST_RETURN_VALUE, ResultType.INTEGER, 0, ListSort(None, aerospike.LIST_SORT_DEFAULT, ListBin("scores")), ), 0,).compile()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_list_sort(NULL, AS_LIST_SORT_DEFAULT, as_exp_bin_list("scores"))), as_exp_int(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByRank( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListSort(as.ListSortFlagsDefault, as.ExpListBin("scores")), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRank( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), ListExp.Sort(ListSortFlags.Default, Exp.ListBin("scores"))), Exp.Val(0)));const Aerospike = require('aerospike')const exp = Aerospike.expconst lists = Aerospike.lists
const filterExp = exp.eq( exp.lists.getByRank( exp.lists.sort(exp.binList('scores'), 0), exp.int(0), exp.type.INT, lists.returnType.VALUE, ), exp.int(0),)Read
list_get_by_index(type, context, result_type, index, bin)Get element at index.
| Name | Type |
|---|---|
type | integer_value |
context | library_specific |
result_type | integer_value |
index | integer_expr |
bin | list_bin_expr |
First element of integer list scores equals 42 (LIST_RETURN_VALUE with integer value type).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByIndex( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(42),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndex( ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_index_range(context, result_type, index, count, bin)Get count elements at index.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
index | integer_expr |
count | integer_expr |
bin | list_bin_expr |
Exactly two elements starting at index 1 in scores (LIST_RETURN_COUNT with index 1 and count 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByIndexRangeCount( as.ListReturnTypeCount, as.ExpIntVal(1), as.ExpIntVal(2), as.ExpListBin("scores"), ), as.ExpIntVal(2),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndexRange( ListReturnType.COUNT, Exp.Val(1), Exp.Val(2), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_index_range_to_end(context, result_type, index, bin)Get elements at and after index.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
index | integer_expr |
bin | list_bin_expr |
Count of elements from index 2 through the end of tags (LIST_RETURN_COUNT).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByIndexRange( as.ListReturnTypeCount, as.ExpIntVal(2), as.ExpListBin("tags"), ), as.ExpIntVal(1),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByIndexRange(ListReturnType.COUNT, Exp.Val(2), Exp.ListBin("tags")), Exp.Val(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),)list_get_by_rank(type, context, result_type, rank, bin)Get element at rank.
| Name | Type |
|---|---|
type | integer_value |
context | library_specific |
result_type | integer_value |
rank | integer_expr |
bin | list_bin_expr |
Smallest value in ordered integer list scores is 12 (rank 0, LIST_RETURN_VALUE).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByRank( as.ListReturnTypeValue, as.ExpTypeINT, as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(12),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRank(ListReturnType.VALUE, Exp.Type.INT, Exp.Val(0), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_rank_range(context, result_type, rank, count, bin)Get count elements at rank.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
rank | integer_expr |
count | integer_expr |
bin | list_bin_expr |
Three smallest values in scores (rank 0, count 3, LIST_RETURN_COUNT).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByRankRangeCount( as.ListReturnTypeCount, as.ExpIntVal(0), as.ExpIntVal(3), as.ExpListBin("scores"), ), as.ExpIntVal(3),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRankRange( ListReturnType.COUNT, Exp.Val(0), Exp.Val(3), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_rank_range_to_end(context, result_type, rank, bin)Get elements at and after rank.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
rank | integer_expr |
bin | list_bin_expr |
Two largest values in scores (rank -2 through last, LIST_RETURN_COUNT).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpEq( as.ExpListGetByRankRange( as.ListReturnTypeCount, as.ExpIntVal(-2), as.ExpListBin("scores"), ), as.ExpIntVal(2),)Expression exp = Exp.Build( Exp.EQ( ListExp.GetByRankRange(ListReturnType.COUNT, Exp.Val(-2), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_rel_rank_range(context, result_type, value, rank, count, bin)Get count element at rank relative to value.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
value | expr |
rank | integer_expr |
count | integer_expr |
bin | list_bin_expr |
Count of elements selected by relative rank range from value 15 (rank offset 0, max 3 items) in scores.
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListGetByValueRelativeRankRangeCount( as.ListReturnTypeCount, as.ExpIntVal(15), as.ExpIntVal(0), as.ExpIntVal(3), as.ExpListBin("scores"), ), as.ExpIntVal(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)));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),)list_get_by_rel_rank_range_to_end(context, result_type, value, rank, bin)Get all elements at and after rank relative to value.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
value | expr |
rank | integer_expr |
bin | list_bin_expr |
Relative rank range from value 15 with rank offset 0 through end of scores (LIST_RETURN_COUNT > 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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListGetByValueRelativeRankRange( as.ListReturnTypeCount, as.ExpIntVal(15), as.ExpIntVal(0), as.ExpListBin("scores"), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueRelativeRankRange( ListReturnType.COUNT, Exp.Val(15), Exp.Val(0), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_value(context, result_type, value, bin)Get all value values from list.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
value | expr |
bin | list_bin_expr |
Filter where string list bin tags contains the value fiction, using LIST_RETURN_EXISTS (see also the path expressions IN-list membership pattern).
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()as_exp_build(predexp, as_exp_cmp_eq( as_exp_list_get_by_value( NULL, AS_LIST_RETURN_EXISTS, as_exp_str("fiction"), as_exp_bin_list("tags")), as_exp_bool(true)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpListGetByValue( as.ListReturnTypeExists, as.ExpStringVal("fiction"), as.ExpListBin("tags"),)Expression exp = Exp.Build( ListExp.GetByValue(ListReturnType.EXISTS, Exp.Val("fiction"), Exp.ListBin("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,)list_get_by_value_list(context, result_type, values, bin)Get all elements with values in values from list.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
values | list_expr |
bin | list_bin_expr |
Integer scores in scores where at least one value matches the list [88, 94] (using LIST_RETURN_COUNT > 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.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()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);// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListGetByValueList( as.ListReturnTypeCount, as.ExpListVal(as.NewValue(88), as.NewValue(94)), as.ExpListBin("scores"), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueList( ListReturnType.COUNT, Exp.Val(new List<int> { 88, 94 }), Exp.ListBin("scores")), Exp.Val(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),)list_get_by_value_range(context, result_type, start, end, bin)Get all elements x in interval start ≤ x < end from list.
| Name | Type |
|---|---|
context | library_specific |
result_type | integer_value |
start | expr |
end | expr |
bin | list_bin_expr |
Integer list scores with values in the half-open interval [10, 50) (using LIST_RETURN_COUNT).
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()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)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListGetByValueRange( as.ListReturnTypeCount, as.ExpIntVal(10), as.ExpIntVal(50), as.ExpListBin("scores"), ), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT( ListExp.GetByValueRange( ListReturnType.COUNT, Exp.Val(10), Exp.Val(50), Exp.ListBin("scores")), Exp.Val(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),)list_size(context, bin)Get list element count.
| Name | Type |
|---|---|
context | library_specific |
bin | list_bin_expr |
integer_bin Filter records whose list bin tags is non-empty (same pattern as bin_list with size).
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()as_exp_build(predexp, as_exp_cmp_gt( as_exp_list_size(NULL, as_exp_bin_list("tags")), as_exp_int(0)));// Requires: import as "github.com/aerospike/aerospike-client-go/v6"_ = as.ExpGreater( as.ExpListSize(as.ExpListBin("tags")), as.ExpIntVal(0),)Expression exp = Exp.Build( Exp.GT(ListExp.Size(Exp.ListBin("tags")), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.lists.size(exp.binList('tags')), exp.int(0),)