MongoDB

From a previous post we talked about the MySQL data base. From this post I’m going to talk about another data base, MongoDB, which is an open source document data base. Document data base means that a record in MongoDB is a document. If you can remember in MySQL all the records were in relations or tables. MongoDB document, which is a data structure composed of field and value pairs will store data. MongoDB provides high performance, high availability and automatic scaling as well. Below there is an example of a document in MongoDB.

crud-annotated-document.png

Now let’s see how to install MongoDB on LINUX.

  • You can download ‘.tgz‘ file from this url.

https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.1.tgz

  • Next extract it anywhere you like.

tar -zxvf <mongodb-install-directory>/mongodb-linux-x86_64ubuntu1404-3.2.1.tgz

  • Add path variables to the ‘./bashrc’.

sudo gedit $HOME/.bashrc

export PATH=<mongodb-install-directory>/bin:$PATH

  • Now we have to create the ‘data’ directory.

sudo mkdir -p /data/db

  • Next change the permissions of created directories.

chmod a+rwx -R /data/db

  • Now we are ready to go, to check whether the MongoDB has installed successfully, type the following command.

100.png

  • Then let’s start the MongoDB server.

101.png

  • Then open a new terminal and type the following command to connect to the server as a client.

103

  • Now you can work on MongoDB.
  • When you are finished working, exit the client.

104.png

  • Finally you can shutdown the server by pressing ‘Ctrl + C‘.

106.png

This is how to successfully install MongoDB on your computer and work with it. Hope now you could be able to install it by yourself. Thank You!

Advertisements

2 thoughts on “MongoDB

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s