Push to two separate arrays in one update call in mongodb

You can specify multiple fields to the $push operator

db.collection.update(
   { _id :1 }, 
   { $push : { array1 : "1",   array2 : "5" }}
)

Leave a Comment