Index object

Index object in persistent storage.


length - integer, length of an index, number of objects associated represented by the index. Read-only property.
asc - boolean, direction of access of objects from the index. Write-only property.
[key] - value, element of the DbIndex at the key position. Read/Write accessor by key. key has to be of the same type as the type of DbIndex object
[begin..end] - keys, keys of first and last element of the range. Returns slice of DbIndex which contains elements from start key and up to end key.
begin is a low boundary of key value (if null then there is no low boundary).
end is a high boundary of key value (if null then there is no high boundary).



( key, val [, replace: true|false ] ) : true|false

Inserts val object into Index and associates it with key value. Optionally replaces it with existing object if it exists.

( key [,obj] ) returns: true | false

Method removes object obj by key from the index. Method returns true on success, otherwise false.
If Index is unique, obj is optional.


( min-key, max-key [, ascent [, start-inclusive [, end-inclusive]]] ) returns: selection object.

Returns selection in the Index based on criteria min-key, max-key, ascent or descent order, start-inclusive, end-inclusive. Default values:

  • ascent = true
  • start-inclusive = true
  • end-inclusive = true

var sel =, maxVal, true);
for( var obj in sel ) { ... }