Skip to main content

Collection Data Types

Aerospike records have one or more bins. Each bin will hold a distinct scalar data type, such as Integer or String, a collection data type, such as List or Map, a probabilistic data type such as HyperLogLog, or a geospatial GeoJSON data type.

Collection data types (CDTs) are flexible, schema-free containers, which can hold scalar data or nest other collections within them. The elements in a CDT can be of mixed types.

CDTs are a superset of JSON, supporting more data types as elements of the collection, such as integers for Map keys, and binary data as List values.

{ 'scores': { 'ACE': [ 34500,
{ 'awards': {'🏆': 1},
'dt': '1979-04-01 09:46:28',
'ts': 291807988156}],
'CFO': [ 17400,
{ 'awards': {'🦄': 1},
'dt': '2017-11-19 15:22:38',
'ts': 1511104958197}],
'CPU': [9800, {'dt': '2017-12-05 01:01:11', 'ts': 1512435671573}],
'EIR': [ 18400,
{'dt': '2018-03-18 18:44:12', 'ts': 1521398652483}],
'ETC': [9200, {'dt': '2018-05-01 13:47:26', 'ts': 1525182446891}],
'SOS': [ 24700,
{'dt': '2018-01-05 01:01:11', 'ts': 1515114071923}]},
'valid': {1: 'a', 2: 'b', 3: 'c', 26: 'z'}}

Collections come with extensive APIs for performing multiple operations in a single record transaction, with policies to control whether an error in any stage of the transaction causes a rollback, skips to the next operation, or partially succeeds before moving to the next operation.

Currently HyperLogLog and bitwise operations cannot be performed on blobs (bindary data) contained within a collection, only at a bin level.