Set a field to the current date.
Section: Field update operators
Stamp an update time
javascript
javascript
db.users.updateOne({ _id: 1 }, { $currentDate: { updated_at: true } })Explanation
A simple way to maintain mutation timestamps from the database side.
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 Field update operators