Skip to content

Record storage

Record storage expressions read user data from bins and from the primary key as typed values: integers, floats, strings, blobs, GeoJSON, lists, maps, HyperLogLogs, and particle types. They are the building blocks for comparison and logic filters, for list, map, and HLL CDT expressions (where you pass a typed bin into ListExp / MapExp / HLLExp), and for path-based filters on nested data.

If the bin is missing or the type does not match, the expression evaluates to unknown (see the expressions overview execution model). For record keys, use the key-type expression that matches how the key was written (integer, string, or blob).

Typed bin readers (bin_int, bin_list, …) pair naturally with the same naming and scenarios as the bookstore / catalog examples elsewhere in this guide.

Ops

bin_blob

bin_blob(name)
Description

Retrieve the bin with the name indicated by name as a blob_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
blob_bin
Introduced
5.2.0.4
Example

Records where blob bin checksum matches a 3-byte prefix (example digest bytes).

Expression exp = Exp.build(
Exp.eq(
Exp.blobBin("checksum"),
Exp.val(new byte[] { 0x01, 0x02, 0x03 })));

bin_exists

bin_exists(name)
Description

Returns true if a bin exists on the record with the name indicated by name, otherwise returns unknown.

Arguments
NameType
name string_value
Returns
boolean_value
Introduced
5.2.0.4
Example

Filter to records that have a quantity bin (any type).

Expression exp = Exp.build(Exp.binExists("quantity"));

bin_float

bin_float(name)
Description

Retrieve the bin with the name indicated by name as a float_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
float_bin
Introduced
5.2.0.4
Example

Records where float bin list_price is under 15 (bookstore-style pricing).

Expression exp = Exp.build(
Exp.lt(Exp.floatBin("list_price"), Exp.val(15.0)));

bin_geo

bin_geo(name)
Description

Retrieve the bin with the name indicated by name as a geojson_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
geojson_bin
Introduced
5.2.0.4
Example

Records whose GeoJSON bin region contains the given point (same pattern as cmp_geo).

String point = "{\"type\":\"Point\",\"coordinates\":[-122.4,37.8]}";
Expression exp = Exp.build(
Exp.geoCompare(Exp.geo(point), Exp.geoBin("region")));

bin_hll

bin_hll(name)
Description

Retrieve the bin with the name indicated by name as a hll_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
hll_bin
Introduced
5.2.0.4
Example

Records where HLL bin visitors has a non-zero estimated cardinality, using HLLExp.getCount on the typed HLL bin.

import com.aerospike.client.exp.HLLExp;
Expression exp = Exp.build(
Exp.gt(HLLExp.getCount(Exp.hllBin("visitors")), Exp.val(0)));

bin_int

bin_int(name)
Description

Retrieve the bin with the name indicated by name as a integer_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
integer_bin
Introduced
5.2.0.4
Example

Records where integer bin quantity is in stock (greater than zero).

Expression exp = Exp.build(
Exp.gt(Exp.intBin("quantity"), Exp.val(0)));

bin_list

bin_list(name)
Description

Retrieve the bin with the name indicated by name as a list_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
list_bin
Introduced
5.2.0.4
Example

Records where list bin tags is non-empty, using the list bin value with a list read expression (size).

import com.aerospike.client.exp.ListExp;
Expression exp = Exp.build(
Exp.gt(ListExp.size(Exp.listBin("tags")), Exp.val(0)));

bin_map

bin_map(name)
Description

Retrieve the bin with the name indicated by name as a map_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
map_bin
Introduced
5.2.0.4
Example

Records where map bin attrs has at least one entry, using MapExp.size on the typed map bin.

import com.aerospike.client.exp.MapExp;
Expression exp = Exp.build(
Exp.gt(MapExp.size(Exp.mapBin("attrs")), Exp.val(0)));

bin_str

bin_str(name)
Description

Retrieve the bin with the name indicated by name as a string_bin. Return unknown if the bin does not exist or the bin is a different type.

Arguments
NameType
name string_value
Returns
string_bin
Introduced
5.2.0.4
Example

Records in the fiction category (string bin category).

Expression exp = Exp.build(
Exp.eq(Exp.stringBin("category"), Exp.val("fiction")));

bin_type

bin_type(name)
Description

Retrieve the data type of the bin with the name indicated by name in ParticleType format. Return unknown if the bin does not exist.

The following list shows each bin ParticleType and its associated integer value:

NULL: 0

INTEGER: 1

DOUBLE: 2

STRING: 3

BLOB: 4

JBLOB: 7

BOOL: 17

HLL: 18

MAP: 19

LIST: 20

GEOJSON: 23

Arguments
NameType
name string_value
Returns
ParticleType
Introduced
5.2.0.4
Example

Filter to records whose sku bin is stored as a string (see ParticleType).

import com.aerospike.client.command.ParticleType;
Expression exp = Exp.build(
Exp.eq(Exp.binType("sku"), Exp.val(ParticleType.STRING)));

key_blob

key_blob()
Description

Retrieve the key as a blob/bytes. Return unknown if the key does not exist or the key is a different type.

Returns
blob_value
Introduced
5.2.0.4
Example

Records whose blob user key matches a short byte sequence (for example a binary id).

Expression exp = Exp.build(
Exp.eq(Exp.key(Exp.Type.BLOB), Exp.val(new byte[] { 0x10, 0x20 })));

key_int

key_int()
Description

Retrieve the key as a integer. Return unknown if the key does not exist or the key is a different type.

Returns
integer_value
Introduced
5.2.0.4
Example

Records whose integer user key is at least 1000 (same units as the key type).

Expression exp = Exp.build(
Exp.ge(Exp.key(Exp.Type.INT), Exp.val(1000)));

key_str

key_str()
Description

Retrieve the key as a string. Return unknown if the key does not exist or the key is a different type.

Returns
string_value
Introduced
5.2.0.4
Example

Records whose string user key is order-42.

Expression exp = Exp.build(
Exp.eq(Exp.key(Exp.Type.STRING), Exp.val("order-42")));
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?