top of page

Database Assignment help using MongoDB

MongoDB stores data in JSON-like documents, which makes the database very flexible and scalable.

To be able to experiment with the code examples in this tutorial, you will need access to a MongoDB database.

You can download a free MongoDB database at

How to install MongoDB ?

Go to the official website

Click Try free at right corner as per given screenshot:

And after this choose server button. Choose OS, and package MIS and after this click on download button.

Click next button:

Accept term and condition, and then click on next button:

Select Choose setup type: complete:

Click on next without changes anything:

Again Click next

Installation started.....

After MongoDB installation successfully finish you click Finish button on next window.

Go to the Program files ->MongoDB->bin

Copy the path and go to the command prompt and paste the path as like and press enter and follow the steps as per given screenshot:

After this type mongod command in your cmd command prompt and press Enter.

Server installation started:

Some exception raise regarding path to create data->db inside C directory.

And after run mongod command to run server.

Open Another command prompt. And run again:

cd C:\Program Files\MongoDB\Server\4.0\bin press enter

and run mongo command on cmd command prompt.

After this to show all previous database inside use command

>Show dbs

Output: it exist default database inside

Admin 0.000GB

Config 0.000GB

Local 0.000GB

Create our database use use command as:

>use naveen

press enter

Switched to db Naveen

>Show dbs

Admin 0.000GB

Config 0.000GB

Local 0.000GB

Not show naveen database because not inserted data so insert data use this command

>db.books.insert({“name”:”mongo book”})

syntax: ( of collection.insert({“keyname”:”value”}))

Press enter and create this collection:


WriteResult({“nInserted” : 1})

To show database use

>show dbs


Admin 0.000GB

Config 0.000GB

Local 0.000GB

Naveen 0.000GB

To list out all the collection use this command

>show collections;

Result: inside the naveen database


Show element inside books collection:



{“_id” : ObjectId(“5cd….c1), “name” : “mongo book”}

Close command prompt

Again open

Run mongodb from anywhere show error internal and external command so need to set environment variable:

C:\users\naveen kumar\mongod

press enter

Error External and Internal command

Set Environment Variable:

Choose path where django installed (C:\Program Files\MongoDB\Server\4.0\bin) and go to system start window choose system and click Advanced system setting. And then click on Environment Variable.

In system variable box find path double click on it.

Click on new and add this path:

C:\Program Files\MongoDB\Server\4.0\bin

Now you can run anywhere by cmd like no need to give complete path.

C:\users\naveen kumar\mongodb

press enter

In next blog we will provide some example with running screenshot.

For more details go to the mongodb official website. For any issue regarding Assignment contact here.

14 views0 comments

Recent Posts

See All
bottom of page