Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongodb mongoose update an element in an array of objects

model.updateOne(
    { _id: "abcxyz", "items._id": "deflmn" },
    {
        $set: {
            "items.$.name": "new_name",
            "items.$.value": "new_value",
         }
    }
)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongodb #mongoose #update #element #array #objects
ADD COMMENT
Topic
Name
8+7 =