To update every document that matches a filter, use the updateMany() method.
javascript
db.inventory.updateMany(
{ qty: { $lt: 50 } },
{
$set: { "status": "low" }
}
)You should see
(Every document with qty below 50 will get a new field: status: "low")