how to add value in array in mongodb code example
Example 1: mongodb add multiple element to array
db.students.update(
{ name: "joe" },
{ $push: { scores: { $each: [ 90, 92, 85 ] } } }
)
Example 2: mongodb push to arry in update
db.collection.update({_id:xx}, {$pop:{letters : -1}})