home shape

ArangoDB 1.4: Introducing Multiple Databases Feature

This version is deprecated. Download the new version of ArangoDB

ArangoDB 1.4 provides support for multiple databases, a feature often requested by our users.

Motivation In the old days, ArangoDB provided the option to create multiple collections, but all collections were created on the same level. As there was no hierarchy of collections, there was a chance of having a collection name clash when using one ArangoDB server for multiple applications. For example, running multiple applications inside the same ArangoDB server did not work if all applications created their own

users collections. Workarounds, such as prefixing collection names, were required to make older ArangoDB versions play nicely with multiple applications. With ArangoDB 1.4, multiple databases are supported natively. Workarounds such as prefixing collection names with application names, can go away now.

How it works With multiple databases, different applications can manage their data independently, using isolated databases each. Databases can be dropped entirely, without affecting collections of other applications. For example, creating two independent databases that both have their own

messages collection is just simple. First database (named myblog): db._createDatabase(“myblog”); // create the database db._useDatabase(“myblog”); // switch into new database db._create(“messages”); // create collection “messages”

We can do the same in another database (named

mychat): db._createDatabase(“mychat”); // create the database db._useDatabase(“mychat”); // switch into new database db._create(“messages”); // create collection “messages”

Individual databases can be accessed via the HTTP API by putting the database name into URLs, e.g. http://localhost:8529/_db/myblog/_api/document/messages/1234

This is the recommended mechanism, though for compatibility reasons ArangoDB also supports URLs that do not contain the database’s name. In case the database name is omitted, ArangoDB will fall back to the default

_system database. Access rights are also managed per database, allowing user-specific database access in a multi-user context. More details on how to use the multiple databases feature can be found here.

Jan Steemann

Jan Steemann

After more than 30 years of playing around with 8 bit computers, assembler and scripting languages, Jan decided to move on to work in database engineering. Jan is now a senior C/C++ developer with the ArangoDB core team, being there from version 0.1. He is mostly working on performance optimization, storage engines and the querying functionality. He also wrote most of AQL (ArangoDB’s query language).

Leave a Comment





Get the latest tutorials, blog posts and news: