Using dynamic Attribute Names in AQL


On our mailing list, there is quite often the question whether attribute names in objects returned from AQL queries can be made dynamic. Jan discusses in his blog how such dynamic attribute names could be expressed and shows the current implementation that comes with ArangoDB 2.5 – adapting an ES6 proposal that might bring robust dynamic variable names to JavaScript as well.

In ArangoDB 2.5 you will be able to use dynamic variable names as follows:

Functions are allowed as well:

Read on here

Using Custom Visitors in AQL Graph Traversals


Jan blogged about some recent extensions for the AQL graph traversal functionality in ArangoDB. These extensions allow invoking user-defined JavaScript code for filtering and results generation in AQL queries that contain traversals.

This should make AQL graph traversals much more powerful than before.

Additionally, AQL graph traversals get more configurable, allowing to write traversal functions with control-flow logic and complex filtering. As a side-effect, this change facilitates writing specialized traversal functions with much higher efficiency than the general-purpose, cover-all-cases default ones.

Continued here on J@ArangoDB’s blog

Explaining AQL queries the fancier way


I have been looking at many AQL queries during the last few weeks…

Looking back, I can say that the JSON query execution plans provided by the explain() method have provided me with a lot of useful information about how the AQL optimizer had transformed a given query. This has helped testing and improving the query optimizer a great deal.

However, the JSON output produced by explain() is so detailed that even for the simplest cases queries it will span multiple screens. This is far too much for quickly assessing what a query will be doing and how it will be executed.

I therefore quickly put together a function that provides a much more compact explain output. Its input parameter is a query string, which it will send to the ArangoDB server to have it explained.

But it doesn’t print a voluminous JSON object. This one is for developers with a full schedule.

Read more on Jan’s Blog

Returning results from modifying AQL operations (V 2.4)


ArangoDB provides many options for finding and modifying data. Though there are several more specialized operation, data-modification AQL queries are the most general solution in ArangoDB. They allow to find documents using arbitrary filter criteria, and to modify or remove the documents once found.

Read in Jan’s blog how INSERT, UPDATE, REMOVE and REPLACE operations can now return modified documents and allow to find, modify and return documents from the same AQL query. Read on

ArangoDB Query Builder

00Foxx, Javascript, Query LanguageTags:

The most powerful way to query your data in ArangoDB is by using ArangoDB’s own query language, AQL. In the past using AQL in your JavaScript code sadly would often require writing long, unwieldy strings. This made writing complex queries difficult and could often lead to subtle syntax errors or mistakes.

The ArangoDB Query Builder (AQB) is a JavaScript node packaged module that provides a fluid API for writing AQL queries in plain JavaScript. And if you’re using ArangoDB 2.3, the aqb module is already available to your Foxx applications. More info

AQL Improvements for 2.4

02Query LanguageTags:

While on a retreat in Belgium, we found some spare time to work on improvements for AQL. These will be shipped with ArangoDB version 2.4, and are already available in the devel version for testing from now on.

Here’s a short overview of the improvements:

Collect with count

A common use case in query languages is to count the number of documents returned by a query. The AQL solution for this has been to use the LENGTH function and a subquery:

This is quite long and probably unintuitive for people which have used SQL for years.

We therefore now allow using the following alternative version:

Read more on Jan’s Blog

A Tour Around the New AQL Query Optimizer

00Query LanguageTags:

The major new feature in ArangoDB 2.3 is the shiny new AQL query optimizer and executor. These parts of ArangoDB have been rewritten in 2.3 to make AQL much better for our end users.

Since one of the initial releases, ArangoDB has been shipped with AQL, the ArangoDB Query Language. AQL has since then been ArangoDB’s most versatile way of executing simple and also the not-so-simple queries.

I’ll start with an overview of query execution in previous versions of ArangoDB, and then explain the new engine and explain the differences.

Read more on Jan’s Blog

Modeling Data in MongoDB vs ArangoDB

05Architecture, Documentation, Graphs, Query LanguageTags: ,

MongoDB is a document DB whereas ArangoDB is a multi-model DB supporting documents, graphs and key/values within a single database. When it comes to data modeling and data querying, they pursue somewhat different approaches.

In a Nutshell: In MongoDB, data modeling is “aggregate-oriented”, avoiding relations and joins. On the other side, everybody has probably used relational databases which organize the data in tables with relations and try to avoid as much redundancy as possible. Both approaches have their pros and cons. ArangoDB is somewhat in-between: You can both model and query your data in a “relational way” but also in an “aggregate-oriented way”, depending on your use case. ArangoDB offers joins, nesting of sub-documents and multi-collection graphs. More info