Answers for "updating an array of object in mongoose"

1

updating an array of object in mongoose

Person.update(
   {
     _id: 5,
     grades: { $elemMatch: { grade: { $lte: 90 }, mean: { $gt: 80 } } }
   },
   { $set: { "grades.$.std" : 6 } }
)
Posted by: Guest on August-23-2020
-1

mongoose update array in object

Person.findOneAndUpdate({_id: id}, 
{ 
  "$set": {[`items.$[outer].${propertyName}`]: value} 
},
{ 
  "arrayFilters": [{ "outer.id": itemId }]
},
function(err, response) {
  ...
})
Posted by: Guest on January-11-2021

Code answers related to "updating an array of object in mongoose"

Code answers related to "Javascript"

Browse Popular Code Answers by Language