ArangoDB AQL Non Case Sensitive Comparison
Asked Answered
I

1

8

Let's imagine I have a few simple docs stored in an Arango collection like so:

[
    {"type":Cat, "quality":Fuzzy}
    {"type":Dog, "quality":Barks}
    {"type":Rabbit, "quality":Hoppy}
    {"type":Pig, "quality":Chubby}
    {"type":Red Panda, "quality":Fuzzy}
    {"type":Monkey, "quality":Hairy}
]

Now let's say a user initiates a search in my application for all animals that are 'fuzzy', all lower case. Is there a way with AQL to make a comparison that is not case sensitive? So for instance:

FOR a IN animals
    FILTER a.type.toLowerCase() == fuzzy
    RETURN a

Now I know the above example doesn't work, but it would be nice if there was a way to do this. Thanks!

Ichthyosis answered 19/2, 2014 at 20:44 Comment(0)
D
9

There is a LOWER string function in AQL which you can try to use in your query like this:

FOR a IN animals
    FILTER LOWER(a.quality) == 'fuzzy'
    RETURN a
Deejay answered 19/2, 2014 at 21:25 Comment(2)
Great I was hoping for something like that! Can u show me where the documentation is for this? I couldn't find it.Ichthyosis
The AQL functions documentation is here: arangodb.org/manuals/current/Aql.html#AqlFunctionsPokey

© 2022 - 2024 — McMap. All rights reserved.