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.
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
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…
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
- After you have succesfully installed mongoDB, open a command window (terminal in Linux).
Switch to the directory where you installed mongodb.
for example in my case, I go to the directory using the command, cd /
- 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
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…
you can execute the basic functions here.
We will see how mongoDB works in the next lesson..