Skip to main content
Loading

Collection data types

Overview

Aerospike collection data types contain an arbitrary number of scalar data type elements, as well as nesting other CDT (List, Map) elements.

Collection data types

Aerospike records have one or more bins. Each bin holds a distinct scalar data type, such as integer or string, a collection data type (CDT), such as List or Map, an Aerospike 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.

HyperLogLogs can be stored within a collection, and updated using write-expressions.CDT also support operations on blobs and Hyperloglogs through the use of read-expressions and write-expressions.