MongoDB: Update Operation

Level : Beginner
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:20:00

Lab Details

Problem Statement:

Update/Add the following field from employee collection in ScholarDB Database:

  • LastName: “Gupta” in document with id: 3
  • Also, Rename the “Phone” to “Contact” in the document with id: 1.

Perform this through MongoDB Shell as well as MongoDB Compass.

Lab Objective:

Upon completion of this lab, you will be able to:

  • Update the documents in a collection.
  • Use MongoDB Compass to Update the document.
  • Use MongoDB shell to Update the document.

Prerequisites

You should install following software on your machine:

  • MongoDB Server 7 or higher
  • MongoDB Shell
  • MongoDB Compass

In this lab, we are working with:

Database: ScholarDB

Collection: employee

Document: six documents that contain the details of employees in the form of field-value pairs.


Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this