db.inventory.updateOne(
{ item: "paper" },
{
$set: { "size.uom": "cm", status: "P" },
$currentDate: { lastModified: true }
}
)
| |
- Find documents satisfying the predicate item = "paper".
- Apply the specified update. $currentDate sets the
lastModified field to the current date.
|