Positional Update
The $ operator updates the matched array item.
Example
db.orders.updateOne(
{ _id: 1, "items.sku": "a1" },
{ $set: { "items.$.qty": 3 } }
)Exercise
Matched item.
"items..qty"
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.