Tsallaka zuwa abun ciki
Justice Tech School

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

What does $set do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.