Update Specific Fields in a Document Step 1: Use update operators to change field values. Step 2: Update an embedded field. Step 3: Update multiple documents. MongoDB Documentation, Release 3.0.4 To change a field value, MongoDB provides update operators$^{12}$, such as $set to modify values. Some update operators, such as $set , will create the field if the field does not exist. See the individual update operator 13 reference. For the document with item equal to "MNO2" , use the $set operator to update the category field and the details field to the specified values and the $currentDate operator to update the field lastModified with the current date. The update operation returns a WriteResult object which contains the status of the operation. A successful update of the document returns the following object: WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) The nMatched field specifies the number of existing documents matched for the update, and nModified specifies the number of existing documents modified. db.inventory.update( { item: "MNO2" }, { $set: { category: "apparel", details: { model: "14Q3", manufacturer: "XYZ Company" } }, $currentDate: { lastModified: true } } ) db.inventory.update( { item: "ABC1" }, { $set: { "details.model": "14Q2" } } ) To update a field within an embedded document, use the dot notation . When using the dot notation, enclose the whole dotted field name in quotes. The following updates the model field within the embedded details document. The update operation returns a WriteResult object which contains the status of the operation. A successful update of the document returns the following object: WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) By default, the update() method updates a single document. To update multiple documents, use the multi option in the update() method. 103 3.3. MongoDB CRUD Tutorials $^{12}$https://docs.mongodb.org/manual/reference/operator/update $^{13}$https://docs.mongodb.org/manual/reference/operator/update