MongoDB: How to get up and running in less than 5 minutes (on Windows)

MongoDB is a “NoSQL” (non-relational) data store of documents that have no predefined schema, where data is stored as a series of JSON objects. The concept of the relational database where there is a database that has tables which are made up of columns and rows, is replaced by the MongoDB concept of a database consisting of “collections”, which are made up of documents full of JSON objects.

This article will focus mainly on the installation of MongoDB on Windows in order to get up and running with it quickly.

Step 1: Download and run the .msi

The .msi can be downloaded from here:

Choose the Community Server option:

The name of the file to download is:

While the installation is running, one of the screens will give the option to choose Complete or Custom. Choose Custom.

Then choose Browse:

This is to change the default installation location from what they recommend:

C:\Program Files\MongoDB\Server\3.6\



Then click Next to continue on with the installation. I chose to allow the installation of MongoDB Compass also.


Step 2: Create folders and run commands in the cmd line

In the new C:\mongodb folder, add a data folder and a log folder.


In the data folder, add a db folder:

Now open a command prompt in Administrator mode. cd to the mongodb\bin folder.

Then type this command:
mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend –install

Then run this command:
net start MongoDB

Then run this command, while still in the bin directory:

Note: There may also be some warning messages in addition to what is shown in the screen shot above.

Type cls to clear the screen. Then run these commands:

show dbs

followed by ‘use’ and then the name of the database you want to create. In this case I want to create a db called ‘microblogs’.

use microblogs

The command db will show you which database you are currently in.


Step 3: Create user

For more information about creating a user, see:

Run the following command block to create new user:

	user: "chris",
	pwd: "password",
	roles: [ "readWrite", "dbAdmin" ]


Step 4: Create a collection

Run the following commands:


show collections

For more information about setting up MongoDB, you can follow along with the Traversy Media video here: