AQB list and string-arrays??

18 views
Skip to first unread message

Julian May

unread,
Jan 6, 2016, 10:11:54 AM1/6/16
to ArangoDB
Hey

I can't figure out how to pass an array of strings into the query builder - it strips the " symbols.
For example, i have a query for a request with an array of roomtypes:

var filter = { roomTypes: ["DBL", "SGL"] }

When i try to set this as an array to "POSITION" in AQL:

aqb.let({roomtypes : aqb.list(filter.roomTypes)})...

I get the error "[ArangoError 1203: collection not found (DBL)]"

aqb.list(filter.roomTypes).toAQL() returns [DBL, SGL], i guess this should be ["DBL", "SGL"], but I can't figure out how to make it so...


Thanks

Alan Plum

unread,
Jan 6, 2016, 11:08:44 AM1/6/16
to ArangoDB
Hi Julian,

The AQB methods like `list` and so on don't escape nested values and instead interpret them (in this case, as identifiers rather than strings).

Instead of using `aqb.list(x)` you should probably use `aqb(x)` directly as this will deep-convert the entire data structure to an AQL value (the equivalent of JSON.stringify).


Cheers,

Alan

Julian May

unread,
Jan 7, 2016, 7:16:01 AM1/7/16
to ArangoDB
Awesome - thanks!
Reply all
Reply to author
Forward
0 new messages