Range Query with Edge

Is it possible to do a range query to Edge?

I am doing "collection.range (attribute, left, right)" where the collection is actually Edge.

And I got a "not implemented" error in ArangoDB 2.3.3 (Win64).

+3


source to share


1 answer


Yes, this is also possible for sets of ribs. All it takes is a skiplist index for the attribute you want to run the range query on. Here's an example to demonstrate it:

/* create some vertices */
var vertices = db._create("vertices");
for (var i = 0; i < 100; ++i) {
  vertices.save({ _key: "v" + i });
}

/* create some edges */
var edges = db._createEdgeCollection("edges");
for (var i = 0; i < 10; ++i) {
  edges.save("vertices/" + i, "vertices/" + i, { value: i }); 
}

/* create the index */
edges.ensureSkiplist("value");

/* run the range query */
edges.range("value", 7, 23).toArray();

      



If the index is not present, "not implemented" may actually be thrown.

+5


source







All Articles