4

How to do a FILTER like this SQL example in AQL?

SELECT * FROM test WHERE option NOT IN ('A', 'B', 'C')
CodeManX
  • 11,159
  • 5
  • 49
  • 70
Tarsis
  • 91
  • 6

1 Answers1

3

In v2.3 and above, it is possible to do:

FOR doc IN test 
  FILTER doc.option NOT IN [ 'A', 'B', 'C' ]
  RETURN doc

In earlier versions, the following should work:

FOR doc IN test 
  FILTER ! (doc.option IN [ 'A', 'B', 'C' ])
  RETURN doc
CodeManX
  • 11,159
  • 5
  • 49
  • 70
stj
  • 9,037
  • 19
  • 33
  • It works, but would be nice to have an alias for `!` > `NOT(...)`. Even better would be a python-like construct `NOT IN`, so you can type the way you speak / think and avoid parentheses. – CodeManX Aug 29 '14 at 16:31
  • 2
    a `NOT IN` construct will come in ArangoDB release 2.3 or 2.4, which contains some major AQL rewrites. – stj Oct 02 '14 at 21:31