0

how to update multiple documents in mongodb native nodejs driver?

  db.remaindMe.update(
    { { "userId": uid, "serviceId": sid, mttabs:"mttabs"  
    }, 
    },
    { $set: { "mttabs":req.body.mttabs  }
    },)
  • Possible duplicate of [MongoDB: How to update multiple documents with a single command?](http://stackoverflow.com/questions/1740023/mongodb-how-to-update-multiple-documents-with-a-single-command) – Thomas Bormans Apr 28 '16 at 06:57

1 Answers1

0
db.remaindMe.update(searchQuery,updateoptions, {multi:true},function(err,data){
if(err){
//Error Message
}
else if(data){
console.log(data);
//do your stuff 
}
});
Shantanu Madane
  • 617
  • 5
  • 14