home shape

ArangoDB 2.7 RC1: Preview the Latest Features

We put a lot of brainpower into the next major release of our favorite database. Thanks to your feedback and contributions we got some important steps forward. Share your professional experiences, opinions and feedback with us on this release candidate of ArangoDB 2.7.

This is a quick info about the upcoming 2.7 release – for details please check our documentation and the changelog.


As performance and ease of use are part of our key goals, we worked hard on some major improvements. Thanks to your feedback and contributions we were able to implement some nice stuff like:

Index buckets

The primary indexes and hash indexes of collections can now be split into multiple index buckets. That said, loading and resizing of large indexes improves significantly in 2.7:

  • Reducing loading time for collections: initially building the in-memory index data can be parallelized (even for a single index)
  • faster resizing: resizing an index when it is about to run out of reserved space is performed per bucket. Resizing and rehashing a bucket is much faster and less intrusive than resizing and rehashing the entire index.

Throughput enhancements

Throughput is another key requirement for a premium database. Again we pushed our throughput a huge step forward with 2.7. We improved the ArangoDB-internal implementations for dispatching requests, keeping statistics and assigning V8 contexts to threads. By this approach we were able to

reduce the use of locks and increase throughput significantly. In real-world cases we measured an increase of throughput by 25-70% compared to 2.6.

AQL improvements

Our goal was to further shorten and ease the writing of statements. These are our key improvements:

Added return distinct syntax

The new RETURN DISTINCT syntax allows you to easily make query results unique. Yes, this was already possible with 2.6 but we put some work in it and with 2.7 we got a lot out of it.

To return unique values from a query, AQL now provides the DISTINCT keyword. It can be used as a modifier for RETURN statements, as a shorter alternative to the already existing COLLECT statement.

FOR doc IN collection

Shorthand object notation

Shorthand object notation is an equivalent to the canonical form (which is still available and supported) but now you can write much shorter and more intuitive statements.

AQL now provides a shorthand notation for object literals in the style of ES6. Here is an example with a mix of short and canonical notation:

RETURN { age, length, dateCreated: DATE_NOW() }

AQL date and time calculation

Added extra AQL functions for date and time calculation and manipulation. These functions were contributed by GitHub users @CoDEmanX and @friday. A big thanks for their work!

  • DATE_DAYOFYEAR(date): Returns the day of year number of date.
  • DATE_ISOWEEK(date): Returns the ISO week date of date.
  • DATE_LEAPYEAR(date): Returns whether the year of date is a leap year.
  • DATE_QUARTER(date): Returns the quarter of the given date
  • DATE_DAYS_IN_MONTH(date): Returns the number of days in date‘s month (28..31).
  • DATE_ADD(date, amount, unit): Adds amount given in unit to date and returns the calculated date.
  • DATE_SUBTRACT(date, amount, unit): Subtracts amount given in unit from date and returns the calculated date.
  • DATE_DIFF(date1, date2, unit, asFloat): Calculate the difference between two dates
  • DATE_COMPARE(date1, date2, unitRangeStart, unitRangeEnd): Compare two partial dates
  • DATE_FORMAT(date, format): Format a date according to the given format string.

Please have a look at the documentation for further details.

Template query strings

Assembling query strings in JavaScript has been error-prone when using simple string concatenation. Since ArangoDB 1.0 query strings are save (query bind parameters). Since ArangoDB 2.5 assembling multi-line query strings is possible but we knew that there must be a better way to combine them in a JavaScript-y style and we found it.

ArangoDB 2.7 now provides an ES6 template string generator function that can be used to easily and safely assemble AQL queries from JavaScript. JavaScript variables and expressions can now be used easily using regular ES6 template string substitutions.

var name = "test"; 
var query = aqlQuery`FOR doc IN collection 
                 FILTER doc.name == ${name} 
                 RETURN doc._key`;

AQL query result cache

We also put some work into the performance of AQL queries and came up with the AQL query result cache. This is especially useful and beneficial for scenarios like read only or read mostly.

With this performance feature you are able to store complete or just selected query results within the cache.

  query: "FOR doc IN users LIMIT 5 RETURN doc",
  cache: true  /* cache attribute set here */

It is a feature for high-performance tasks or if you just want your results in no time. Of course you can configure this feature to your individual needs and turn it off and on as you like. Check out our AQL query cache documentation for detailed info on configuration and handling.

Julie Ferrario

Leave a Comment

Get the latest tutorials, blog posts and news: