When should I use AQL?
Asked Answered
S

1

11

In the context of ArangoDB, there are different database shells to query data:

Although I understand the use of JavaScript and MRuby, I am not sure why I would learn, and where I would use AQL. Is there any information on this? Is the idea to POST AQL directly to the database server?

Stagey answered 18/2, 2013 at 9:41 Comment(0)
G
6

AQL is ArangoDB's query language. It has a lot of ways to query, filter, sort, limit and modify the result that will be returned. It should be noted that AQL only reads data.

(Update: This answer was targeting an older version of ArangoDB. Since version 2.2, the features have been expanded and data modification on the database is also possible with AQL. For more information on that, visit the documentation link at the end of the answer.)

You cannot store data to the database with AQL.

In contrast to AQL, the Javascript or MRuby can read and store data to the database. However their querying capabilities are very basic and limited, compared to the possibilities that open up with AQL.

It is possible though to send AQL queries from javascript. Within the arangosh Javascript shell you would issue an AQL query like this:

    arangosh> db._query('FOR user IN example FILTER user.age > 30 RETURN user').toArray()
[
  { 
    _id : "4538791/6308263", 
    _rev : "6308263", 
    age : 31, 
    name : "Musterfrau"
   }
]

You can find more info on AQL here: http://www.arangodb.org/manuals/current/Aql.html

Guido answered 18/2, 2013 at 11:7 Comment(4)
Thanks! In the documentation there is written: "You can run AQL queries from your application via the HTTP REST API" ... so, I also could run AQL with e.g. Curl ?Stagey
Exactly. In fact, all language drivers use the HTTP REST API. The REST API is ArangoBD's interface to the world. If for example you program in a language that has no driver available yet, you can start a project writing your own driver. It's all HTTP.Guido
Not sure about the status of things at Feb, but with AQL you can definitely change and store data into database (example: arangodb.com/tutorial-node-js/#aql-update). It does not matter how the AQL is run, it has always the same capabilities.Barone
On February >2013< things were different... ;) Nevertheless, I'll update the answer to account for the new features...Guido

© 2022 - 2024 — McMap. All rights reserved.