ArangoDB 2.4 Release: New Features & Enhancements
This version is deprecated. Download the new version of ArangoDB
We are proud to announce the release of Version 2.4 of our multi-model database ArangoDB. It’s ready for download now and available for all major platforms.
This release is a major step forward. Use Foxx to create your favorite microservice with a few clicks, dockerize it and access it via a REST/Web API from everywhere. – Dr. Frank Celler (CTO)
You can now use EcmaScript 6 features like iterators, symbols, maps and sets by default and enable even more ES6 features with ArangoDB start options. The V8 engine upgrade in ArangoDB 2.4 also improves performance and speeds up V8 garbage collections.
The ArangoDB query language (AQL) gets more efficient group count calculation queries, an optional return value for AQL data-modification queries and improved index handling in filtering AQL queries.
Foxx 2.0: The new Foxx-Generator is a framework that enables developers to build Hypermedia APIs easily. Developers can create Web APIs based on a semantic description of entities and transitions using a statechart alike design approach. Additional to the recently added job queues and authentication services, Foxx got a new web-frontend to easily create new or install Foxx applications from Github or the ArangoDB Store.
Try the new tutorial Foxx in 10 Minutes to build your first Foxx application. Starting with a new Foxx app has never been easier.
Along with ArangoDB the new light-weight JavaScript driver arangojs 3.0 is ready to use.
Download the current 2.4 release and start building your own applications on top of ArangoDB!
Here are the release notes of ArangoDB 2.4:
V8 Version Upgrade
The built-in version of V8 has been upgraded from 3.16.14 to 3.29.59. This activates several ES6 (also dubbed Harmony or ES.next) features in ArangoDB, both in the ArangoShell and the ArangoDB server. They can be used for scripting and in server-side actions such as Foxx routes, traversals etc.
The following ES6 features are available in ArangoDB 2.4 by default:
- iterators
- the
of
operator - symbols
- predefined collections types (Map, Set etc.)
- typed arrays
Many other ES6 features are disabled by default, but can be made available by starting arangod or arangosh with the appropriate options:
- arrow functions
- proxies
- generators
- String, Array, and Number enhancements
- constants
- enhanced object and numeric literals
(Arrow function with 2 parameters)
To activate all these ES6 features in arangod or arangosh, start it with the following options:
arangosh --javascript.v8-options="--harmony --harmony_generators"
More details on the available ES6 features can be found in this blog post.
AQL
Added optional return value for AQL data-modification queries.
This allows returning the documents inserted, removed or updated with the query, e.g. FOR doc IN docs REMOVE doc._key IN docs LET removed = OLD RETURN removed
FOR doc IN docs
INSERT { } IN docs LET inserted = NEW
RETURN inserted
FOR doc IN docs
UPDATE doc._key WITH { } IN docs LET previous = OLD
RETURN previous
FOR doc IN docs
UPDATE doc._key WITH { } IN docs LET updated = NEW
RETURN updated
The variables OLD
and NEW
are automatically available when a REMOVE
, INSERT
, UPDATE
or REPLACE
statement is immediately followed by a LET
statement. See the full change log for further information.
Added optional COUNT
clause to AQL COLLECT
This allows more efficient group count calculation queries, e.g.
FOR doc IN collection
COLLECT age = doc.age WITH COUNT INTO length
RETURN { age: age, count: length }
A count-only query is also possible:
FOR doc IN collection
COLLECT WITH COUNT INTO length
RETURN length
Finally, COLLECT ... INTO
has been extended to support just another variant that can reduce the amount of copying inside a query.
FOR doc IN collection
COLLECT age = doc.age INTO g = doc.dateRegistered
RETURN { age: age, maxDate: MAX(g) }
AQL: range optimizations for IN and OR
This change enables usage of indexes for several additional cases. Filters containing the IN
operator can now make use of indexes, and multiple OR- or AND-combined filter conditions can now also use indexes if the filters are accessing the same indexed attribute.
Here are a few examples of queries that can now use indexes but couldn’t before:
FOR doc IN collection
FILTER doc.indexedAttribute == 1 || doc.indexedAttribute > 99
RETURN doc
FOR doc IN collection
FILTER doc.indexedAttribute IN [ 3, 42 ] || doc.indexedAttribute > 99
RETURN doc
FOR doc IN collection
FILTER (doc.indexedAttribute > 2 && doc.indexedAttribute < 10) ||
(doc.indexedAttribute > 23 && doc.indexedAttribute < 42)
RETURN doc
Added Foxx generator for building Hypermedia APIs
ArangoDB 2.4 is shipped with FoxxGenerator, a framework for building standardized Hypermedia APIs easily. The generated APIs can be consumed with client tools that understand Siren.
Hypermedia is the simple idea that our HTTP APIs should have links between their endpoints in the same way that our web sites have links between them. FoxxGenerator is based on the idea that you can represent an API as a statechart: Every endpoint is a state and the links are the transitions between them. Using your description of states and transitions, it can then create an API for you.
The FoxxGenerator can create APIs based on a semantic description of entities and transitions. A blog series on the use cases and how to use the Foxx generator is here:
- Building Hypermedia APIs – Links and Forms in JSON
- Building Hypermedia APIs – a Design Approach using Statecharts
- Building Hypermedia APIs – FoxxGenerator
A cookbook recipe for getting started with FoxxGenerator is here.
New Applications tab in web interface
The applications tab got a complete redesign. It will now only show applications that are currently running on ArangoDB. For a selected application, a new detailed view provides the following information: author, license, version, contributors, download links and API documentation.
To install a new application, a new dialogue is now available.
It provides the features already available in the console application foxx-manager
plus some more:
- install an application from Github
- install an application from a zip file
- install an application from ArangoDB’s application store
- create a new application from scratch: this feature uses a generator to create a Foxx application with pre-defined CRUD methods for a given list of collections.
The generated Foxx app can either be downloaded as a zip file or be installed on the server.
New JavaScript driver arangojs
The official ArangoDB low-level JavaScript client for node.js and browsers, arangojs 3.0, is available from npm.
npm install arangojs
All asynchronous functions now take node-style callback functions (or “errbacks”) with the following arguments: err
: an Error object if an error occurred, or null if no error occurred. result
: the function’s result (if applicable). For expected API errors, err
will be an instance of ArangoError
.
The new driver provides just enough abstraction to be useful on its own but also keeps it lean enough to provide a basis for custom abstraction layers. You can add the promises library of your choice (e.g. bluebird or Q) using the node-style callbacks of arangojs. With the earlier released AQL query builder module you can write AQL queries in JavaScript.
There is an example GitHub crawler that shows how you can use the new driver.
4 Comments
Leave a Comment
Get the latest tutorials, blog posts and news:
Congratulations ArangoDB team, this is an impressive release.
Curious if foxx works well within angular app, perhaps an article on this would be helpful to others.
Thank’s Serge.
We currently do so, the Angular / Foxx article will be published soon.
A backlash sneaked into the AQL code snippet (right before _key): UPDATE doc._key WITH { } IN docs LET previous = OLD
Thanks, I fixed it.