Sorry for the delay, we are working a lot on release 3.1;)
I think that you have already found the right solution: It is impossible to express what you would like to achieve in instruction 1..2 OUTBOUND . This is easier to state in two operations 1..1 OUTBOUND .
From your explanation, I think the following query is what you will use:
FOR thread IN 1 OUTBOUND @start @@threadEdges LET nr = COUNT(FOR message IN 1 OUTBOUND thread @@messageEdges RETURN 1) RETURN { date: thread.date, category: thread.category, messages: nr }
For some explanation: first select the associated stream. Then I do a subquery so that messages for a single thread can simply. Finally, I return the information I need.
In terms of performance: As for data access (which is most likely a bottleneck), there is no difference in FOR x IN 1..2 OUTBOUND [...] and FOR x IN 1 OUTBOUND [...] FOR y IN 1 OUTBOUND x [...] , both must look at exactly the same documents. In the latter case, query optimization may be a little slower, but the difference is below 1ms .
source share