How to pass variable arrays to array function without error?

6 views
Skip to first unread message

じょいすじょん

unread,
Mar 30, 2020, 4:22:29 AM3/30/20
to ArangoDB
I have a collection of documents, some of which have a different count of items in an array in the document.
I can do a COLLECT and get an arrray of arrays, but I cannot pass it to array functions without errors.

How can I get the delta items ?

I'm trying to do

let problemIds = (
FOR doc IN
@@collection
    FILTER COUNT
( doc.problems) > 0
    COLLECT probs
= doc.problems[*].id INTO probIds
return probs
)
return OUTERSECTION( a IN problemIds )


The poblemIds comes out fine as an array of arrays.
In this case 2 arrays. One has more items than the other and I want to identify the delta items.
passing this to OUTERSECTION() gives an error in the web UI.

Query: AQL: invalid number of arguments for function 'OUTERSECTION()', expected number of arguments: minimum: 2, maximum: 65536 (while parsing)



Is there some way to tell the function to use the members of the array as the arguments?
[*] doesn't seem to do it.
What is the obvious thing I am missing?

I can do it like this

FOR problemId IN DOCUMENT("somedoc/58603525").problems[*].id
    FILTER problemId NOT IN DOCUMENT
("somedoc/58603526").problems[*].id
    RETURN problemId




But it sure seems like there must be a more graceful way.

Reply all
Reply to author
Forward
0 new messages