Answers for "mongodb push into existing array using object"

1

mongodb + add to array

db.students.updateOne(
   { name: "joe" },
   { $push: { scores: { $each: [ 90, 92, 85 ] } } }
)
Posted by: Guest on May-04-2022
6

mongodb push to arry in update

db.collection.update({_id:xx}, {$push:{letters : {$each:['first one'], $position:0}}})
Posted by: Guest on March-22-2020
3

mongodb push to arry in update

db.collection.update({_id:xx}, {$pop:{letters : -1}})
Posted by: Guest on March-22-2020

Browse Popular Code Answers by Language