It looks like this:
YOURSCHEMA.update( { _id: "DocumentObjectid" , "ArrayName.id":"ArrayElementId" }, { $set:{ "ArrayName.$.TheParameter":"newValue" } }, { upsert: true }, function(err){ } );
In this example, I am looking for an element with an id parameter, but it may be the actual _id parameter of type objectId.
Also see: MongooseJS Doc - Set Update and Related SO Question
guiomie
source share