Thirawato
Thirawato

Reputation: 35

How to reverse the result from traverse command?

Assuming, there are vertices and edges as below.

if we query data using traverse command, TRAVERSE out() from [#20:0, #20:5, #20:7], we will get the result [#20:0, #20:1, #20:2, #20:3, #20:4, #20:5, #20:6, #20:7, #20:8].

However I want the reversed result for each target. it will look like [#20:4, #20:3, #20:2, #20:1, #20:0, #20:6, #20:5, #20:8, #20:7].

Is there any way to make the result reversed as above using a single query?

PS: I am using version 2.2.13.

Thank you,

Upvotes: 1

Views: 63

Answers (1)

Thirawato
Thirawato

Reputation: 35

I have got a workaround by myself. I added $depth to the query in order to use depth=0 as the check point for reversing the order.

SELECT *, $depth from (TRAVERSE out() from [#20:0, #20:5, #20:7])

Upvotes: 1

Related Questions