MongoDB-The best NoSQL ever

MongoDB is the new featuring of sql servers that doesn’t need qetting a large set of queries to get our work done.

This is a NoSQL kind of database (Not Only SQL) that is written in C++.

This can be used like any other Database Server we use on many Operating Systems.

To get started we follow the following things…

1.Download source files.

You can download the source file (.msi/.exe/.zip) from the downloads page of MongoDB Website

Notice: Please download the file as .zip extension as it doesnot need much work to get installed and it is the safest procedure.

2.Installation:

After downloading now extract the mongodb folder and place it in the root directory of your ‘C’ drive(This is only for better performance…you can install MongoDB in any drive).

Now you should see the following files in c:/mongodb/bin

Files in mongodb directory

Mongodb files

Most of all your work you will work with some data that is stored in your file system. This is the main advantage of MongoDB.

So,you have to create a data file that will use the data you have updated previously.

To do that, just create a folder named data in the root of your mongoDB directory..This should look like this…

mongodb data folder

MongoDB data folder

 

Now you can chose to create a log file using the procedure as follows.

1.create a file called mongod.config (you can name it what ever you want…), and type the following lines in it

dbpath = C:\mongodb\data  //here is where all your data will be stored while you work
port = 27017  //this is the default port number on which mongoDB runs.
logpath = C:\mongodb\logs\mongo.log  //here is where all your log will be stored

2.Create a folder called logs

3.Running MongoDB service

  1.  After you have succesfully installed mongoDB, open a command window (terminal in Linux).

  2. Switch to the directory where you installed mongodb.

for example in my case, I go to the directory using the command, cd /

  1. type the command to start MongoDb service…

c:\>  cd mongodb/bin

                 c:\mongodb\bin\> mongod –config c:/mongodb/mongod.config

now you should see some data that speaks about starting the service.

4.Connecting to the Database

To connect to the database just open another command window and type the following commands..

c:\>  cd mongodb/bin

                 c:\mongodb\bin\> mongo

or you can run the Database by double-clicking the mongo.exe file in the bin folder

Now you should see the following result on the window…

Connecting to MongoDB

database connectivity

you can execute the basic functions here.

We will see how mongoDB works in the next lesson..

About these ads

One thought on “MongoDB-The best NoSQL ever

Leave a Reply

Please log in using one of these methods to post your comment:

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