How to push an array of objects into an array in mongoose with one call?

(Dec-2014 update) Since MongoDB2.4 you should use:

Kitten.update({name: 'fluffy'}, {$push: {values: {$each: [2,3]}}}, {upsert:true}, function(err){
        if(err){
                console.log(err);
        }else{
                console.log("Successfully added");
        }
});

Leave a Comment