Skip to content
Justice Tech School

findOneAndUpdate

Update and return the document.

Example
db.users.findOneAndUpdate(
  { name: "Ada" },
  { $inc: { age: 1 } },
  { returnDocument: "after" }
)

Exercise

Return new doc.

returnDocument: ""

Quiz Test

What does after return?

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