Installation & Introduction to MongoDb – NOSql Database

MongoDb is a NOSQL database.

Once HDP Sandbox environment is available on your windows machine, let’s setup MongoDb Server on this virtual centOS machine.

To set up Hadoop Sandbox Environment on your windows machine – Follow the Steps in the post that we posted earier

  1. Connect to your machine via Putty.
  2. Server IP – & Port- 2222
  3. Username – root & default password – hadoop
  4. cd /etc/yum.repos.d/
  5. vi mongodb-org-4.2.repo

  1. Paste the below repositories url in the .repo file.


name=MongoDB Repository





  1. Install the MongoDb packages.

sudo yum install -y mongodb-org

  1. Start MongoDb service.

Service mongod restart

  1. Check MongoDb version.

mongod –version


  1. Quick go-through commands to use database, insert and find objects in collection.

show dbs –  will show databases,

use instrovate_db  

db.employee.insert({“id”:”101,”name”:”Ravi Kumar”}) – to create and insert data in collection.

db.find.employee() – to list the data in collection


  1. Find the employee where id = 101


  1. And operator in find query : where id =102 and name = dhruva


  1. Update document (Name updated from Ravi Kumar to Ravi Kumar shrivastav)

db.employee.update({“name”:”Ravi Kumar”},{$set:{“name”:”Ravi Kumar shrivastav”}})


  1. Delete document


  1. Filtering & Sorting of data in desc order.