Comparing version 0.1.11 to 0.1.12
0.1.12 / 2012-05-25 | ||
=================== | ||
* Added package.json tags. | ||
* Added support for update with ids (fixes #4) | ||
0.1.11 / 2012-05-22 | ||
@@ -3,0 +9,0 @@ =================== |
@@ -135,2 +135,6 @@ | ||
Collection.prototype.update = function (search, update, opts, fn) { | ||
if ('string' == typeof search || 'function' == typeof search.toHexString) { | ||
return this.update({ _id: search }, update, opts, fn); | ||
} | ||
if ('function' == typeof opts) { | ||
@@ -137,0 +141,0 @@ fn = opts; |
{ | ||
"name": "monk" | ||
, "version": "0.1.11" | ||
, "version": "0.1.12" | ||
, "main": "lib/monk.js" | ||
, "tags": ["mongodb", "mongo", "driver"] | ||
, "dependencies": { | ||
@@ -6,0 +7,0 @@ "mongoskin": "0.3.6" |
@@ -130,2 +130,30 @@ | ||
}); | ||
it('should work with an objectid', function (done) { | ||
users.insert({ worked: false }, function (err, doc) { | ||
expect(err).to.be(null); | ||
users.update(doc._id, { $set: { worked: true } }, function (err) { | ||
expect(err).to.be(null); | ||
users.findOne(doc._id, function (err, doc) { | ||
expect(err).to.be(null); | ||
expect(doc.worked).to.be(true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('should work with an objectid (string)', function (done) { | ||
users.insert({ worked: false }, function (err, doc) { | ||
expect(err).to.be(null); | ||
users.update(doc._id.toString(), { $set: { worked: true } }, function (err) { | ||
expect(err).to.be(null); | ||
users.findOne(doc._id, function (err, doc) { | ||
expect(err).to.be(null); | ||
expect(doc.worked).to.be(true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -132,0 +160,0 @@ |
31580
918