updateOne and $set
Change fields in one document.
Example
db.users.updateOne(
{ name: "Ada" },
{ $set: { age: 31, city: "Lagos" } }
)Exercise
Set a field.
{ : { age: 31 } }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.