GRAPH_TRAVERSAL result enclosed in (Array of) Array of Array in Arangodb

64 views Asked by At

I am exploring Arangodb and in particular Graph Operations

I am referring to example in the section 12.9 Graph Operations of the doc.

The result of GRAPH_TRAVERSAL_TREE query operations are inserted in Array of Array of Array:

[[[{"_id":", "connection": []  }]]]

Is there a reason for this ?

1

There are 1 answers

0
mchacki On BEST ANSWER

The reason is the internal format and backwards compatibility:

To describe it in a bit more detail:

The outer most array is added by AQL which always encapsulates it's result in an array, within the AQL query this outer array is not there. The second array is added because GRAPH_TRAVERSAL_TREE uses an example for the start-vertex. This example could match more than one vertex (e.g.: {name: 'Peter'} would be a valid value for startVertex). Each of these startVertices will have one entry in this array. The innermost array is for compatibility reasons with TRAVERSAL_TREE. Hence we get 3 layers of arrays in this function.

But please stay tuned for one of next releases. We are working hard on a new interface for graph traversals making it much easier to control the traversal and the result format. (This does not mean we will abandon the Graph features we already have ;) )