Multiple Databases – New Feature in Version 1.4
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
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.
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.
Get the latest tutorials, blog posts and news: