# Updating Documents

Updating Documents: Changing Documents with updateOne and $set, More Update Operators: $inc, $push, $pull and $addToSet, Upserts and Replacing a Whole Document.

Updated: November 19, 2026

1. [Changing Documents with updateOne and $set](https://www.ask-codey.com/lessons/mongodb-updateone-and-set) (Apprentice): updateOne and updateMany change documents where they are, with a filter that picks the documents and an update operator that says what changes; $set writes fields, $unset removes them, and matchedCount and modifiedCount report what happened.
2. [More Update Operators: $inc, $push, $pull and $addToSet](https://www.ask-codey.com/lessons/mongodb-update-operators) (Apprentice): $inc lets the database do the counting so no count is lost, $currentDate stamps when a change happened, $push and $pull add to and remove from a list, and $addToSet adds an item only when it isn't there yet.
3. [Upserts and Replacing a Whole Document](https://www.ask-codey.com/lessons/mongodb-upserts-and-replaceone) (Journeyman): An upsert updates a document when the filter finds one and inserts it when it doesn't, $setOnInsert sets values only on that first insert, replaceOne swaps in a whole new version, and findOneAndUpdate changes a document and hands it back.

Source: https://www.ask-codey.com/courses/mongodb-in-depth/topics/mongodb-updating-documents
