Sequence NODE_275
MediumUpdate Nested Field in Embedded Document
MongoDB
Technical Specification
Update a user's address.city field without replacing the entire address object.
Input/Output Samples
Input:user email = a@b.com
Output:address.city updated
Optimal Logic Path
db.users.updateOne(
{ email: "happy@example.com" },
{ $set: { "address.city": "Delhi" } }
);Architectural Deep-Dive
Dot notation lets you update deeply nested fields without overwriting other keys in the object.