MongoDB Step by Step — Part 1 — Overview and Local Setup

Shadik khan
4 min readJan 31, 2017

A month ago I was doing a research on database performance. When we design a database, one of the factors we need to think about is performance. Always think about the cost of operations we are to do like insert, update, delete etc.

Until recent years, Relational Databases like MySQL, SQL and SQLite, were in practice but lately Document Oriented Databases like NoSQL, MongoDB have picked up very well. Although there are more database like Graph Database, Full Text Database, Key Value Database etc.

In this Series I will share my research about MongoDB and operations with queries. In the end of this series we will also check about some advance concept, little bit more performance improvement and scalability.

Who Else is using MongoDB, Am I the only one?

No, I am not the only one. MongoDB has a very good market coverage. According to MongoDB website, companies like Expedia, Forbes, Bosch, MetLife, Comcast are using MongoDB-as a-service and the list goes on and on.

SO! What is this MongoDB?

MongoDB is not like Relational DBMS (RDBMS)in which you have to create Table in database, create column, Primary key concept, foreign key concept, join (inner, outer, left, right) blah blah blah…

MongoDB is document oriented database also cross-platform, meaning it will store data in form of a document. It will be much clearer when we go for operations. It provides high performance, high availability and easy scalability. It works on concept of collection and document.

Collections

Like in RDBMS e.g. MySQL we create database in that database we can create multiple tables, Collection is a group of MongoDB documents (Just like Tables) exist in single database.

Document

Just like we have table ROWs in RDBMS, in MongoDB we have document. Document stores the data as Key Value pair.

Relationship of RDBMS Terminology with MongoDB

RDBMS and Mongo Relationship in Terminology

MongoDB uses JSON documents in order to store the records, JSON database returns query result which can be easy parsed by your favourite programming language(s). Internally MongoDB represents these JSON documents in Binary Encoded JSON also known as BSON. Get more details from here.

Setup MongoDB Locally (Server and Client)

For setting up MongoDB locally on windows, first you have to download the msi from https://www.mongodb.com/download-center?jmp=nav#community. This is community server setup for our test purpose use. You can choose as per your choice, and also you can select the platform on which you want to setup from here.

After downloading the compatible msi file double click on it and follow the steps of installation. After the successful installation we can check that by going through the path, mine is “C:\Program Files\MongoDB\Server\3.4\bin”. There must be bin folder. Copy this path till bin and set as path in environment variable via system settings.

Path setting, System Environment Variable

Start Local MongoDB Server

After setting this path you will be able to start MongoDB server and client from command prompt, from any path just writing mongod –dbpath=”your data storage path”.

MongoDB Local Server Running

Now MongoDB local server is up and running on port 27017 and waiting for client connection(s).

Start Local Client and connect to Server

From above section your MongoDB server is running and waiting for connection(s), Now it’s time to start client and connect with this running server. For this task we have start another command prompt (Not the same in which server is running) and write the command mongo, it will start a client and connect to running server.

Now your local client is connected to server and you are good to go for further experiment on mongoDB.

I am closing this introductory part here, and the next parts with basic schema concept and operations in MongoDB.

Thanks for being till here. If you find this helpful, be sure to click ❤ recommend. It means a lot.

--

--