Tuesday, July 12, 2016

Learning MongoDB - 1

 

MongoDB is a document oriented NOSQL DB. MongoDB supports linear scalability.

What is NOSQL DB?

In simple words nosql is nothing but non sql or non relational. Basically nosql DB allows storing and retrieving of non relational or tabular data. So this is quite opposite of what oracle and other RDBMS does.

Why we need NOSQL DB?

You can find lot of information in this page.

What is linear scalability?

Scalability is nothing but capacity of the system,network or process to handle more work. Linear scalability mens increase of the capcity of the syetem,process or network by adding more hardware instead of making changes at the code level.

What are the types of NOSQL DBs?

There are multiple types of NOSQL DBs like key-value stores, document databases, wide-column stores, and graph databases.

Where to download MongoDB for learning?

You can download it from this link.

Installing the mongoDB on windows?

Just double click the downloaded file and follow the instructions.

Starting mongoDB?

  • First create a data folder for mongoDB. I have created mine as D:\MongoDB\data
  • Also create a log folder mine is like D:\MongoDB\logs
  • Create a config file under install directory, simple config file D:\MongoDB\Server\3.2\bin\first.cfg looks like

systemLog:
    destination: file
    path: D:\MongoDB\logs\mongod.log
storage:
    dbPath: D:\MongoDB\data

  • Start MongoDB by going to command prompt and to the directory D:\MongoDB\Server\3.2\bin, there execute the command

mongod –config first.conf

  • Check the log file to see if the mongod started propertly you should be seeing a message like “waiting for connections on port 27017”.

Connecting to MongoDB?

Execute the command “mongo” you will see the follwing prompt

D:\MongoDB\Server\3.2\bin>mongo
2016-07-13T09:44:22.613+0530 I CONTROL  [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
MongoDB shell version: 3.2.7
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
>

Also the DB can be accessed using http://localhost:27017/test

This is end of part 1.

Next part covers programatic way to connect to MongoDB.

 


 

 

 

No comments:

Post a Comment