How to update multiple documents in mongodb native nodejs driver?

Salam (means hello) :)

I'm running mongodb 2.4.8 and Mongo DB Native NodeJS Driver. when I use the following function, only first document that matched query updates. how can I update all matching documents?

function update(coll, query, update, callback){
    var options = options || {};
    MongoClient.connect('mongodb://', function(error, db) {
            return console.dir(error);
        db.collection(coll).update(query, update, {w:1}, function(error, result) {
            callback(error, result);

I installed my mongodb driver via npm install mongodb command, which installs version 1.3.23, does this driver version support multi update? if not, how can I install a newer version of driver supports multi update?

Leave a Reply

Your email address will not be published. Required fields are marked *