iridium
Advanced tools
Comparing version 7.0.1 to 7.0.2
@@ -330,17 +330,14 @@ "use strict"; | ||
return new Bluebird((resolve, reject) => { | ||
if (opts.multi) | ||
return this.collection.updateMany(conditions, changes, opts, (err, response) => { | ||
if (err) | ||
return reject(err); | ||
// New MongoDB 2.6+ response type | ||
if (response.result && response.result.nModified !== undefined) | ||
return resolve(response.result.nModified); | ||
// Legacy response type | ||
return resolve(response.result.n); | ||
}); | ||
return this.collection.update(conditions, changes, opts, (err, response) => { | ||
const callback = (err, response) => { | ||
if (err) | ||
return reject(err); | ||
return resolve(1); | ||
}); | ||
// New MongoDB 2.6+ response type | ||
if (response.result && response.result.nModified !== undefined) | ||
return resolve(response.result.nModified); | ||
// Legacy response type | ||
return resolve(response.result.n); | ||
}; | ||
if (opts.multi) | ||
return this.collection.updateMany(conditions, changes, opts, callback); | ||
return this.collection.updateOne(conditions, changes, opts, callback); | ||
}); | ||
@@ -347,0 +344,0 @@ }).nodeify(callback); |
@@ -676,2 +676,3 @@ "use strict"; | ||
return model.get().then(instance => { | ||
instance.answer++; | ||
return chai.expect(model.update(instance._id, instance.document, { multi: false })).to.eventually.equal(1); | ||
@@ -678,0 +679,0 @@ }); |
{ | ||
"name": "iridium", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
696874
7278