Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose query document

1.
model.updateOne(
   { <array>: value ... },
   { <update operator>: { "<array>.$" : value } }
)
db.students.updateOne(
   { _id: 4, "grades.grade": 85 },
   { $set: { "grades.$.std" : 6 } }
)
 
PREVIOUS NEXT
Tagged: #mongoose #query #document
ADD COMMENT
Topic
Name
8+7 =