MongoDB Tutorial Part- I – Creating a Database

mongoDBMongoDB is an open-source document-oriented database. Document-oriented means it stores the data in a file. MongoDb comes under the category of NoSql database. It stores the data in BSON (Binary JSON) format. It can be accessed through javascript notation and comes with their own shell. It is written in C++.

Why use MongoDB

1. It stores the data in JSON format.

2. Full index support.

3. Replication and high availability.

4. Auto-sharding

How to Install MongoDB on Linux, Windows and Mac OS

Go to the download page of MongoDB and choose the production release for the operating system you use.

If you are using Ubuntu here is a complete installation doc for Ubuntu

Installation guide for nosql database

Installation guide for nosql database

MongoDB Terminology

Before going to create our first database with MongoDB let’s first familiar with their terms.

1. Database – It is a set of collections.

2. Collections – Collection in MongoDB is like a table in MySql. But it does not have schema.

3. Document – It is like a record or row in relational databases (like mysql). In mongoDB record is stored in BSON (Binary Json) format.

Subscribe Our Tutorials

Get Latest Updates on Facebook

4. Field – It is similar to column in relational databases .

Creating Database with MongoDB

I assume you have installed MongoDB successfully in your system. Go to the terminal (ctrl + Alt + T) and type mongo and press enter. It opens up a mongo shell.


To check all the database

Let’s insert some records in our emp collection. We have not created any database yet but mongodb creates when record is inserted.

Now the value is inserted successfully, you can check through find() command.


_id field is created by mongoDB automatically. It is the auto-increment field.

To view the output in proper format


In next post i will talk about queries on mongoDB.


About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged . Bookmark the permalink.