Modify selected fields without replacing the whole document.
Section: Update and delete
Update one document with $set
javascript
javascript
db.products.updateOne({ sku: "A100" }, { $set: { price: 59, in_stock: false } })Explanation
`$set` is the most common operator for partial updates.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Update and delete