ArangoDB is a NoSQL database engine that supports three common data models: graphs, JSON documents and key/value store. You can use them all or just a single one, all easily accessible via very powerful query language. It runs on almost every environment and scales rapidly fast. Let’s have a brief look at it and answer the question why it’s my data storage engine choice in 2018.

The project

First of all, it’s open source. And the community around the project is pretty big: 4726 stars on Github and over 1300 registered users on Slack.

Everytime I have had to ask a question on their Slack channel there were always community members and very often even its authors. That’s really good to be supported, especially when the project is open source – those people very often spend their own time and they don’t have to do that – so be grateful and if you can, try to help either.

But coming back to people around ArangoDB, you should know that the company behind it – Germany based ArangoDB GmbH – have done a wonderful job raising 4.2 million euro this year. So, engaged community and a commercial success behind it? Sounds like a great project!

Multi-model, so what?

ArangoDB natively combines Key/Value pairs, document store and Graph database in one engine. And yes – you can access them all in one single query!

ArangoDB claims to be fully ACID complaint. You can store JSON documents containing unlimited number of attributes (up to 32MB by default) and query them even using SQL-like JOINs.

Key/Value store’s most common use cases are web applications session data, cache layer or shopping basket. All of these you can achieve with high performance using ArangoDB.

The most interesting is graph data model with features known from other popular graph databases like: finding shortest path, pattern matching and complete traversals.

ArangoDB Query Language, or just AQL

That’s one of the coolest features I love ArangoDB for. You can get pretty much all the data you need with one simple SQL-like query:

Create documents:


1
2
3
4
5
6
FOR city IN [
  { name: "Chiang Mai", country: "Thailand" },
  { name: "Bangkok", country: "Thailand" },
  { name: "London", country: "United Kingdom" }
]
  INSERT city INTO cities

Read:


1
2
FOR city IN cities
  RETURN city

Update:


1
2
3
UPDATE { _key: "x" }
  WITH { name: "Bangkok" }
  IN cities

Delete:


1
2
REMOVE { _key:"x" }
  IN cities

JOINs:


1
2
3
4
FOR city IN cities
  FOR country IN countries
    FILTER country.name == city.country
    RETURN MERGE(city, country)

That’s only a few simple self-explaining examples. You can find lots more, including complex ones and SQL comparision in the official ArangoDB docs section SQL / AQL – Comparison.

Built-in web admin interface

ArangoDB comes with a buit-in admin interface accessible via web browser. That’s pretty cool for those who prefer visual access rather than CLI tools.

In the Web UI you can do all the administrative tasks, monitor your cluster health or run and optimise AQL queries. It also includes interactive graph viewer where you can visualise your graphs and correlation between them.

The query running tool allows you to save queries, give them names and come back later. Worth mentioning is it’s ability to explain your queries and address performance issues, comparable to SQL’s EXPLAIN QUERY.

Getting started

The easiest way to get started is downloading a package for your operating system and following installation manual:
https://www.arangodb.com/download-major/

For macOS you can also use homebrew:

brew install arangodb

And if you are familiar with docker there is also an official docker repository:

docker run -p 8529:8529 -e ARANGO_ROOT_PASSWORD=topsecret arangodb/arangodb:latest

Summary

I hope I gave you a brief introduction and enough information to start playing with ArangoDB multi-model database. This article covered my subjective opinion on it and I’m very happy to know your thoughts in comments.

There are a lot of nice features of ArangoDB that were uncovered in this article like Foxx framework that allows you to deploy JavaScript microservices and run them inside your ArangoDB instance, but that’s a story for another blog post.