This is an introduction to ArangoDB's skip-lists.
It is possible to define a skip-list index on one or more attributes (or paths) of a documents. This skip-list is then used in queries to locate documents within a given range. If the skip-list is unique, then no two documents are allowed to have the same set of attribute values.
ensureUniqueSkiplist(field1, field2, ..., fieldn)
In case that the index was successfully created, the index identifier is returned.
arango> db.geo2.drop(); true arango> db.geo2.ensureGeoIndex("location.latitude", "location.longitude"); 23735273 arango> for (i = -90; i <= 90; i += 10) .......> for (j = -180; j <= 180; j += 10) .......> db.geo2.save({ name : "Name" + i + "-" + j, .......> location: { latitude : i, .......> longitude : j } }); arango> db.geo2.near(0,0); { "location" : { "latitude" : 0, "longitude" : 0 }, "name" : "Name0-0", "_id" : "48956356:73466820" } { "location" : { "latitude" : 0, "longitude" : -10 }, "name" : "Name0--10", "_id" : "48956356:73401284" } . . { "location" : { "latitude" : 20, "longitude" : -10 }, "name" : "Name20--10", "_id" : "48956356:75891652" } { "location" : { "latitude" : 10, "longitude" : 20 }, "name" : "Name10-20", "_id" : "48956356:74843076" } ...more results...
ensureSkiplist(field1, field2, ..., fieldn)
In case that the index was successfully created, the index identifier is returned.
arango> db.geo2.drop(); true arango> db.geo2.ensureGeoIndex("location.latitude", "location.longitude"); 23735273 arango> for (i = -90; i <= 90; i += 10) .......> for (j = -180; j <= 180; j += 10) .......> db.geo2.save({ name : "Name" + i + "-" + j, .......> location: { latitude : i, .......> longitude : j } }); arango> db.geo2.near(0,0); { "location" : { "latitude" : 0, "longitude" : 0 }, "name" : "Name0-0", "_id" : "48956356:73466820" } { "location" : { "latitude" : 0, "longitude" : -10 }, "name" : "Name0--10", "_id" : "48956356:73401284" } . . { "location" : { "latitude" : 20, "longitude" : -10 }, "name" : "Name20--10", "_id" : "48956356:75891652" } { "location" : { "latitude" : 10, "longitude" : 20 }, "name" : "Name10-20", "_id" : "48956356:74843076" } ...more results...