Ensure server : mongod is up & running and then execute commands on mongo shell

step 1: Create DB

use crudsysDB

step 2: Insert document on the fly by giving collection name

db.tblEmployeeColl.insert({
_id:1,
FirstName:”Nagendra”,
LastName:”Kumar”,
Age:25,
MailId:”Nagendra.Kumar@crudsys.com”
})

3

Ste 3: Read Document

db.tblEmployeeColl.find()

or
db.tblEmployeeColl.find().pretty()

4

Step 4: Update Document

db.tblEmployeeColl.update({
_id:1 },{$set:{LastName:”Ponnaganti”,MailId:”Nagendra.Ponnagnti@crudsys.com”}
})

updated

updated2

Step 5: Delete Document

db.tblEmployeeColl.remove({_id:1})

delete

del

Step 7: Drop DB

2

db.dropDatabase()

happ