Arango DB Overview
ArangoDB is hailed as a native multi-model database by its developers. This is unlike other NoSQL databases. In this database, the data can be stored as documents, key/value pairs or graphs. And with a single declarative query language, any or all of your data can be accessed. Moreover, different models can be combined in a single query. And, owing to its multi-model style, one can make lean applications, which will be scalable horizontally with any or all of the three data models.
Important Link : (Arango DB official document for reference )
https://www.arangodb.com/docs/stable/
ArangoDB ─ Features
There are various notable features of ArangoDB. We will highlight the prominent features below −
- Multi-model Paradigm
- ACID Properties
- HTTP API
ArangoDB supports all popular database models. Following are a few models supported by ArangoDB −
- Document model
- Key/Value model
- Graph model A single query language is enough to retrieve data out of the database
The four properties Atomicity, Consistency, Isolation, and Durability (ACID) describe the guarantees of database transactions. ArangoDB supports ACID-compliant transactions.
ArangoDB allows clients, such as browsers, to interact with the database with HTTP API, the API being resource-oriented and extendable with JavaScript.
Basic Concepts and Terminologies
Here will discuss the basic concepts and terminologies for ArangoDB. It is very important to have a knowhow of the underlying basic terminologies related to the technical topic we are dealing with.
The terminologies for ArangoDB are listed below −
- Document
- Collection
- Collection Identifier
- Collection Name
- Database
- Database Name
- Database Organization
From the perspective of data model, ArangoDB may be considered a document-oriented database, as the notion of a document is the mathematical idea of the latter. Document-oriented databases are one of the main categories of NoSQL databases.
The hierarchy goes like this: Documents are grouped into collections, and Collections exist inside databases
It should be obvious that Identifier and Name are two attributes for the collection and database.
Usually, two documents (vertices) stored in document collections are linked by a document (edge) stored in an edge collection. This is ArangoDB's graph data model. It follows the mathematical concept of a directed, labeled graph, except that edges don't just have labels, but are full-blown documents.
Having become familiar with the core terms for this database, we begin to understand ArangoDB's graph data model. In this model, there exist two types of collections: document collections and edge collections. Edge collections store documents and also include two special attributes: first is the _from attribute, and the second is the _to attribute. These attributes are used to create edges (relations) between documents essential for graph database. Document collections are also called vertex collections in the context of graphs (see any graph theory book).
Let us now see how important databases are. They are important because collections exist inside databases. In one instance of ArangoDB, there can be one or many databases. Different databases are usually used for multi-tenant setups, as the different sets of data inside them (collections, documents, etc.) are isolated from one another. The default database _system is special, because it cannot be removed. Users are managed in this database, and their credentials are valid for all the databases of a server instance.
ArangoDB - Database Methods
To start with, let us get the properties of the Database −
- Name
- ID
- Path First, we invoke the Arangosh. Once, Arangosh is invoked, we will list the databases we created so far −
We will use the following line of code to invoke Arangosh −
127.0.0.1:8529@_system> db._databases()
Output
[
"_system",
"song_collection"
]
We see two databases, one _system created by default, and the second song_collection that we have created.
Let us now shift to song_collection database with the following line of code −
127.0.0.1:8529@_system> db._useDatabase("song_collection")
Output
true
127.0.0.1:8529@song_collection>
We will explore the properties of our song_collection database.
To find the name We will use the following line of code to find the name.
127.0.0.1:8529@song_collection> db._name()
Output
song_collection
To find the id − We will use the following line of code to find the id.
127.0.0.1:8529@song_collection> db._id()
Output
4838
To find the path − We will use the following line of code to find the path.
127.0.0.1:8529@song_collection> db._path()
Output
/var/lib/arangodb3/databases/database-4838
Let us now check if we are in the system database or not by using the following line of code −
127.0.0.1:8529@song_collection&t; db._isSystem()
Output
false
It means we are not in the system database (as we have created and shifted to the song_collection). The following screenshot will help you understand this.
To get a particular collection, say songs − We will use the following line of code the get a particular collection.
127.0.0.1:8529@song_collection> db._collection("songs")
Output
[ArangoCollection 4890, "songs" (type document, status loaded)]
The line of code returns a single collection.