Basic Sorting is natively supported in large lists (LDT).
In a Large List your key (index) is always ordered in a lexical manner by default.
Please notice that ldt-enabled true
directive must be present in the namespace's config area in aerospike.conf
an example with the javascript client
var key = {ns: 'test', set: 'mySet', key: 'myKey'};
var callback = function (status, result) {console.log(status, result)}
var list = client.LargeList(key, 'targetBinName', null, callback));
// add first item (also determinate the list values type)
list.add(1, callback);
// add multiple items
list.add([0, 2, 4, 5], callback);
list.add(3, callback);
// get all items
list.scan(function (status, list) {
// list = [0, 1, 2, 3, 4, 5]
})
// select by values range
list.findRange(0, 3, callback)
// filter using udf to do custom gt/lt filtering
list.filter('udfName', callback)
if you need to store objects then you must add a key
property that will be the index for sorting, range, duplicates etc (no duplicates are allowed by default)
list.add({key: 1})
list.add([{key: 0},{key: 2}])
I'm sure the other languages drivers have the same methods more or less.
more on Large list in Aerospike docs
Large list docs section in NodeJS client on Github