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!

skinneejoe
  • 3,921
  • 5
  • 30
  • 45

1 Answers1

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
yojimbo87
  • 65,684
  • 25
  • 123
  • 131
  • Great I was hoping for something like that! Can u show me where the documentation is for this? I couldn't find it. – skinneejoe Feb 20 '14 at 02:49
  • 2
    The AQL functions documentation is here: https://www.arangodb.org/manuals/current/Aql.html#AqlFunctions – stj Feb 20 '14 at 07:51