MongoDB is an established NoSQL Database. It is a dynamic, Object Oriented Database. Many of the top companies in the world uses MongoDB, for instance Google, Facebook etc.

Some of the notable features includes, but not limited to :

  • Uses JSON styled BSON documents to store data
  • Have a Powerful and flexible query language
  • Supports Aggregation framework
  • Provides Out of the box functionalities such as Sharing Replication etc
  • Have good Geo-spatial support

Download MongoDB

Head over to the MongoDB site to download the community version.

For Windows, you can download either a Zip or MSI version. However, I’ll have the instructions for Zip Version. Because, MSI version is fairly simpler to install, just need to download and follow instructions on the installer.

For Unix variants, Please download the TGZ package. If you need the simpler configuration, Many Unix repos has MongoDB added and you can use them out of the box as mentioned here for Ubuntu or Mac OS.

If you are following the installer, please skip to the Connecting Server section.

Once MongoDB is downloaded, decompress it to a folder.

For Unix:
tar -xvzf mongodb-macos-x86_64-4.2.1.tgz

Starting the Server

Before we start the server, we need to set up the data folder (this can be customized) where the server data files will be stored, like:


In terminal, navigate to the bin folder under MongoDB folder and type:

$ ./mongod
+0000 I  NETWORK  [initandlisten] waiting for connections on port 27017

Connecting to the MongoDB Server

From Terminal

from the bin folder, type:

$ ./mongo
MongoDB shell version v4.2.1
connecting to: mongodb://
Implicit session: session { "id" : UUID("4c7f9c7b-b007-4c6f-bdd6-f79d5d02fef3") }
MongoDB server version: 4.2.1
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

Type a command and check the output. show dbs will show the list of active Databases in server.

Using Robo 3T

Robo 3T, formerly RoboMongo, is a light weight Open Source GUI for MongoDB. Download from here. Follow the installer and install the Application. Open the Application. It’ll open with a screen with list of Active Connections:

click on Create and add new Connection Details. Since we are using the default mongo configuration, the server will listen to port 27017 on localhost. Enter those details in the Create Connection Box with a name. After entering the info, click on Test to test the connection. Then Save the connection. Mongo configuration:

Name: Localhost Connection (or any name you want)
Address: localhost
Port: 27017

After saving, Robo 3T will list the added connection. Click on the connection and click Connect. It’ll establish a connection and list active databases in the server.

Basic MongoDB Commands

Please refer here for a detailed list of commonly used commands and queries.

Create Database:

Use the use command to create a database.

> use universe
switched to db universe

Create Collection:

> db.createCollection('planet')
{ "ok" : 1 }

> show collections
> show dbs
admin     0.000GB
config    0.000GB
local     0.000GB
universe  0.000GB

Same operations can be done via Robo 3T as well:


This should get you started with MongoDB.

Additional Readings

MongoDB Commonly used Commands

MongoDB Commonly used Queries

MongoDB Commonly used Aggregation Queries

Credits: Image by Free-Photos from Pixabay