In this chapter, we will discuss the different Database Methods in ArangoDB.
To start with, let us get the properties of the Database −
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()
[ "_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")
true 127.0.0.1:8529@song_collection>
We will explore the properties of our song_collection database.
We will use the following line of code to find the name.
127.0.0.1:8529@song_collection> db._name()
song_collection
We will use the following line of code to find the id.
song_collection
4838
We will use the following line of code to find the path.
127.0.0.1:8529@song_collection> db._path()
/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()
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.
We will use the following line of code the get a particular collection.
127.0.0.1:8529@song_collection> db._collection("songs")
[ArangoCollection 4890, "songs" (type document, status loaded)]
The line of code returns a single collection.
Let us move to the essentials of the database operations with our subsequent chapters.