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”
})
Ste 3: Read Document
db.tblEmployeeColl.find()
or
db.tblEmployeeColl.find().pretty()
Step 4: Update Document
db.tblEmployeeColl.update({
_id:1 },{$set:{LastName:”Ponnaganti”,MailId:”Nagendra.Ponnagnti@crudsys.com”}
})
Step 5: Delete Document
db.tblEmployeeColl.remove({_id:1})
Step 7: Drop DB
db.dropDatabase()