Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range query with Edge

Tags:

arangodb

Is it possible to do the range query against a Edge?

I'm doing "collection.range(attribute, left, right)", where collection is in fact a Edge.

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

like image 204
LongkerDandy Avatar asked May 25 '26 05:05

LongkerDandy


1 Answers

Yes, it is possible also for edge collections. All that is required is a skiplist index on the attribute you want to run the range query on. Here's an example demoing 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 no index is present, the in fact the "not implemented" may be thrown.

like image 83
stj Avatar answered May 30 '26 07:05

stj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!