# findOneAndUpdate

*noun*

say it: **“FYND WUN and UP-dayt”** **/ˈfaɪnd ˈwʌn ənd ˈʌpdeɪt/**

A MongoDB method that changes one matching document and returns it, as it was before the change or as it is after.

## What does **findOneAndUpdate** do?

**findOneAndUpdate** changes the first matching document and gives that document back in the same step. By default you get it as it was before the change; `returnDocument: "after"` gives the changed version.

```javascript
db.recipes.findOneAndUpdate(
  { _id: 4 },
  { $inc: { saves: 1 } },
  { returnDocument: "after" }
);
// { _id: 4, name: 'Chickpea Curry', saves: 14, ... }
```

## In a sentence

- “Without returnDocument set to after, **findOneAndUpdate** hands back the document as it was before the change.”
- “The save button calls **findOneAndUpdate** so the page can show the new save count right away.”

Level: Journeyman · [More MongoDB terms at this level](https://www.ask-codey.com/glossary?category=mongodb&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/findoneandupdate
