Skip to content

Map expressions

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

Map expressions read and modify map values inside an expression tree. For the data type itself and its Operate API, see Map.

Read expressions (map_size, map_get_by_key, map_get_by_value, the index, rank and range variants) evaluate to whatever result_type selects — a count, an index, a rank, a key, 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 (map_put, map_put_items, map_increment, map_clear, the map_remove_by_* variants) evaluate to a new map and leave the record untouched. Storing that value takes a write operation expression; see Operations and expressions for how the two APIs differ.

A map operand is a bin, read with bin_map, or any expression that evaluates to a map. 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 map operations as path functions, for example $.profile.name.setTo('Alice').

Composing expressions

An expression evaluates to a value, and that value is what the next expression operates on — see Expressions compose.

Every map operation takes its bin operand that way: not only a named map bin, but the result of any expression evaluating to a map. map_put shows the pattern — its example takes the map_size of the map after the put, so the size counts the new entry while the record keeps the original.

Extraction helpers

map_keys and map_values (Database 8.1.2 and later) are standalone readers: they take a map operand and nothing else, evaluating to a list of the map’s keys or of its values. Alone among the map reads they take neither a context nor a result_type, because there is only one thing each can return.

Use them to turn a map into a list that the rest of the expression tree can work on — testing membership with in_list, for instance, or counting with list_size.

A difference from the CDT Map API

A map modify expression evaluates to the whole modified map. The matching CDT Map operation returns something narrower and operation-specific: put returns the new entry count, and the remove-by operations return what result_type selects.

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

map_clear

map_clear(context, bin)
Description

Returns the map with all elements removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using an empty map after map_clear.

String exp = "$.stock:MAP.clear().count() == 0";

map_increment

map_increment(context, policy, key, delta, bin)
Description

Returns the map with the value at key increased by delta.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

policyMap policy

Write flags for the operation. See Write flags. A violated flag fails the expression, unless no_fail is set, in which case the map comes back unchanged. The policy’s ordering attribute has no effect here: order is fixed when a map is created, and an expression never creates one.

keyany

Map key the operation applies to.

deltainteger or float

Amount to add to the value stored under key. A negative value subtracts. The stored value’s own type governs: a float added to an integer is truncated toward zero first, so adding 1.5 adds 1 and adding 0.5 leaves it unchanged.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the value at sku-a after incrementing it by 5.

String exp = "($.stock.'sku-a'.add(5)).'sku-a' == 100";

map_put

map_put(context, policy, key, value, bin)
Description

Returns the map with value stored at key. It does not create a bin that does not exist, unlike the put CDT Map operation, which does.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

policyMap policy

Write flags for the operation. See Write flags. A violated flag fails the expression, unless no_fail is set, in which case the map comes back unchanged. The policy’s ordering attribute has no effect here: order is fixed when a map is created, and an expression never creates one.

keyany

Map key the operation applies to.

valueany

Value to store under key, replacing any value already there.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation

put

Example

Hypothetical filter using the map after putting {sku-a: 12} into stock.

String exp = "$.stock.'sku-a'.setTo(12).count() > 2";

map_put_items

map_put_items(context, policy, items, bin)
Description

Returns the map with every entry of items added. It does not create a bin that does not exist, unlike the put_items CDT Map operation, which does.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

policyMap policy

Write flags for the operation. See Write flags. A violated flag fails the expression, unless no_fail is set, in which case the map comes back unchanged. The policy’s ordering attribute has no effect here: order is fixed when a map is created, and an expression never creates one.

itemsmap

Key/value pairs to write, as a map. A key already present is overwritten; a key that is absent is added.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map after merging additional SKU entries into stock.

String exp = "$.stock.putItems({'sku-b': 2, 'sku-c': 3}).count() > 3";

map_remove_by_index

map_remove_by_index(context, index, bin)
Description

Returns the map with the element at index removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing index 0.

String exp = "$.stock.{0}.remove().count() > 0";

map_remove_by_index_range

map_remove_by_index_range(context, index, count, bin)
Description

Returns the map with count elements removed, starting at index.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing one entry at index 0.

String exp = "$.stock.{0:1}.remove().count() > 0";

map_remove_by_index_range_to_end

map_remove_by_index_range_to_end(context, index, bin)
Description

Returns the map with every element from index to the end removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing from index 1 to the end.

String exp = "$.stock.{1:}.remove().count() > 0";

map_remove_by_key

map_remove_by_key(context, key, bin)
Description

Returns the map with the element at key removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

keyany

Map key the operation applies to.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing key sku-a.

String exp = "$.stock.'sku-a'.remove().count() == 2";

map_remove_by_key_list

map_remove_by_key_list(context, keys, bin)
Description

Returns the map with every element whose key is in keys removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

keyslist

Keys to match, as a list. Every entry whose key appears in it is removed.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing two keys.

String exp = "$.stock.{@'sku-a', 'sku-b'}.remove().count() == 1";

map_remove_by_key_range

map_remove_by_key_range(context, key_begin, key_end, bin)
Description

Returns the map with every element whose key is in the interval key_begin ≤ k < key_end removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

key_beginany

Lowest key to match, inclusive.

key_endany

Upper bound on the key, exclusive. Omit it to match everything from key_begin upward.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing a key interval.

String exp = "$.stock.{@'sku-a':'sku-z'}.remove().count() > 0";

map_remove_by_rank

map_remove_by_rank(context, rank, bin)
Description

Returns the map with the element of rank rank removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing rank 0.

String exp = "$.stock.{#0}.remove().count() > 0";

map_remove_by_rank_range

map_remove_by_rank_range(context, rank, count, bin)
Description

Returns the map with count elements removed, starting at rank rank.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing two ranks starting at 0.

String exp = "$.stock.{#0:2}.remove().count() > 0";

map_remove_by_rank_range_to_end

map_remove_by_rank_range_to_end(context, rank, bin)
Description

Returns the map with every element of rank rank or higher removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing from rank 1 to the last rank.

String exp = "$.stock.{#1:}.remove().count() > 0";

map_remove_by_rel_index_range

map_remove_by_rel_index_range(context, key, index, count, bin)
Description

Returns the map with count elements removed, starting at the index index places from key.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

keyany

Map key the operation applies to.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after a key-relative index remove with count.

String exp = "$.stock.{0:0~'sku-a'}.remove().count() > 0";

map_remove_by_rel_index_range_to_end

map_remove_by_rel_index_range_to_end(context, key, index, bin)
Description

Returns the map with every element from the index index places from key to the end removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

keyany

Map key the operation applies to.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after a key-relative index remove to end.

String exp = "$.stock.{0:~'sku-a'}.remove().count() > 0";

map_remove_by_rel_rank_range

map_remove_by_rel_rank_range(context, value, rank, count, bin)
Description

Returns the map with count elements removed, starting at the rank rank places from value.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

valueany

Value that rank is measured from. It need not be present in the collection — the rank is taken from where it would sort.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after a value-relative rank remove with count.

String exp = "$.stock.{#0:1~5}.remove().count() > 0";

map_remove_by_rel_rank_range_to_end

map_remove_by_rel_rank_range_to_end(context, value, rank, bin)
Description

Returns the map with every element from the rank rank places from value to the highest rank removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

valueany

Value that rank is measured from. It need not be present in the collection — the rank is taken from where it would sort.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after a value-relative rank remove to end.

String exp = "$.stock.{#0:~5}.remove().count() > 0";

map_remove_by_value

map_remove_by_value(context, value, bin)
Description

Returns the map with every element whose value equals value removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

valueany

Value to match. Every entry whose value equals it is removed.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing by value 12.

String exp = "$.stock.{=12}.remove().count() > 0";

map_remove_by_value_list

map_remove_by_value_list(context, values, bin)
Description

Returns the map with every element whose value is in values removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

valueslist

Values to match, as a list. Every entry whose value equals any of them is removed.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing by values 5 and 12.

String exp = "$.stock.{=5, 12}.remove().count() > 0";

map_remove_by_value_range

map_remove_by_value_range(context, value_begin, value_end, bin)
Description

Returns the map with every element whose value is in the interval value_begin ≤ v < value_end removed.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

value_beginany

Lowest value to match, inclusive.

value_endany

Upper bound on the value, exclusive. Omit it to match everything from value_begin upward.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
map
Introduced
5.2.0.4
Operate API operation
Example

Hypothetical filter using the map size after removing values in [5, 20).

String exp = "$.stock.{=5:20}.remove().count() > 0";

Read

map_get_by_index

map_get_by_index(type, context, result_type, index, bin)
Description

Returns the element at index.

Arguments
NameTypeDescription
typeinteger 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.

contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the integer value at map index 0 equals 12.

String exp = "$.stock.{0} == 12";

map_get_by_index_range

map_get_by_index_range(context, result_type, index, count, bin)
Description

Returns count elements starting at index.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where two entries exist starting at map index 0.

String exp = "$.stock.{0:2}.count() == 2";

map_get_by_index_range_to_end

map_get_by_index_range_to_end(context, result_type, index, bin)
Description

Returns every element from index to the end.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count from index 1 to the end is positive.

String exp = "$.stock.{1:}.count() > 0";

map_get_by_key

map_get_by_key(type, context, result_type, key, bin)
Description

Returns the element at key.

Arguments
NameTypeDescription
typeinteger 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.

contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

keyany

Map key the operation applies to.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the integer value at key sku-a in stock equals 12.

String exp = "$.stock.'sku-a' == 12";

map_get_by_key_list

map_get_by_key_list(context, result_type, keys, bin)
Description

Returns every element whose key is in keys.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

keyslist

Keys to match, as a list. Every entry whose key appears in it is selected.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the map has positive COUNT for keys sku-a and sku-b in stock.

String exp = "$.stock.{@'sku-a', 'sku-b'}.count() > 0";

map_get_by_key_range

map_get_by_key_range(context, result_type, key_begin, key_end, bin)
Description

Returns every element whose key is in the interval key_begin ≤ k < key_end.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

key_beginany

Lowest key to match, inclusive.

key_endany

Upper bound on the key, exclusive. Omit it to match everything from key_begin upward.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count of map entries with keys less than sku-z is positive.

String exp = "$.stock.{@:'sku-z'}.count() > 0";

map_get_by_rank

map_get_by_rank(type, context, result_type, rank, bin)
Description

Returns the element of rank rank.

Arguments
NameTypeDescription
typeinteger 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.

contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the lowest-ranked value equals 5.

String exp = "$.stock.{#0} == 5";

map_get_by_rank_range

map_get_by_rank_range(context, result_type, rank, count, bin)
Description

Returns count elements starting at rank rank.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where exactly two entries are selected starting at rank 0.

String exp = "$.stock.{#0:2}.count() == 2";

map_get_by_rank_range_to_end

map_get_by_rank_range_to_end(context, result_type, rank, bin)
Description

Returns every element of rank rank or higher.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count from rank 0 to the last rank is positive.

String exp = "$.stock.{#0:}.count() > 0";

map_get_by_rel_index_range

map_get_by_rel_index_range(context, result_type, key, index, count, bin)
Description

Returns count elements starting at the index index places from key.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

keyany

Map key the operation applies to.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where exactly one entry is selected starting at index 0 relative to key sku-a.

String exp = "$.stock.{0:0~'sku-a'}.count() == 1";

map_get_by_rel_index_range_to_end

map_get_by_rel_index_range_to_end(context, result_type, key, index, bin)
Description

Returns every element from the index index places from key to the end.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

keyany

Map key the operation applies to.

indexinteger

Zero-based position in the collection, 0 being the first element. A negative index counts back from the end.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the COUNT of entries from index 0 relative to key sku-a is positive.

String exp = "$.stock.{0:~'sku-a'}.count() > 0";

map_get_by_rel_rank_range

map_get_by_rel_rank_range(context, result_type, value, rank, count, bin)
Description

Returns count elements starting at the rank rank places from value.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

valueany

Value that rank is measured from. It need not be present in the collection — the rank is taken from where it would sort.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

countinteger

Number of elements in the range.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where bounded relative-rank selection from value 5 has positive COUNT.

String exp = "$.stock.{#0:1~5}.count() > 0";

map_get_by_rel_rank_range_to_end

map_get_by_rel_rank_range_to_end(context, result_type, value, rank, bin)
Description

Returns every element from the rank rank places from value to the highest rank.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

valueany

Value that rank is measured from. It need not be present in the collection — the rank is taken from where it would sort.

rankinteger

Rank of the element in value order, 0 being the smallest. A negative rank counts back from the largest.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where relative rank selection from value 5 has positive COUNT.

String exp = "$.stock.{#0:~5}.count() > 0";

map_get_by_value

map_get_by_value(context, result_type, value, bin)
Description

Returns every element whose value equals value.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

valueany

Value to match. Every entry whose value equals it is selected.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count of map entries with value 12 is positive.

String exp = "$.stock.{=12,}.count() > 0";

map_get_by_value_list

map_get_by_value_list(context, result_type, values, bin)
Description

Returns every element whose value is in values.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

valueslist

Values to match, as a list. Every entry whose value equals any of them is selected.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count of entries with values 5 and 12 is positive.

String exp = "$.stock.{=5, 12}.count() > 0";

map_get_by_value_range

map_get_by_value_range(context, result_type, value_begin, value_end, bin)
Description

Returns every element whose value is in the interval value_begin ≤ v < value_end.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

result_typeinteger literal

Which form the result takes, such as count, index, rank, or value. See Return types.

value_begininteger

Lowest value to match, inclusive.

value_endinteger

Upper bound on the value, exclusive. Omit it to match everything from value_begin upward.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
any
Introduced
5.2.0.4
Operate API operation
Example

Filter where the count of values in [5, 50) in stock is positive.

String exp = "$.stock.{=5:50}.count() > 0";

map_keys

map_keys(bin)
Description

Returns the map’s keys as a list. Unlike the other map reads it takes neither a context nor a result_type, because there is only one thing it can return.

Arguments
NameTypeDescription
binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
list
Introduced
8.1.2
Example

Get the keys of map bin stock as a list, then check its list_size is greater than 0.

String exp = "$.stock:MAP.*.getKeys().count() > 0";

map_size

map_size(context, bin)
Description

Returns the number of elements in the map.

Arguments
NameTypeDescription
contextContext instance

Optional context path selecting a List or Map nested inside the operand. Omit it to operate on the top level.

binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
integer
Introduced
5.2.0.4
Operate API operation
Example

Filter records whose map bin stock is non-empty (same pattern as bin_map with size).

String exp = "$.stock:MAP.count() > 0";

map_values

map_values(bin)
Description

Returns the map’s values as a list. Unlike the other map reads it takes neither a context nor a result_type, because there is only one thing it can return.

Arguments
NameTypeDescription
binmap

Map bin to operate on, or any expression that evaluates to a map.

Returns
list
Introduced
8.1.2
Example

Get the values of map bin stock as a list, then check its list_size is greater than 0.

String exp = "$.stock:MAP.*.count() > 0";