Comparing version
0.1.4 / 2012-05-06 | ||
================== | ||
* Ensured insert calls back with a single object. | ||
* Ensured `insert` resolves promise in next tick. | ||
0.1.3 / 2012-05-03 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -262,3 +262,7 @@ | ||
debug('%s insert "%j"', this.name, data); | ||
this.col.insert(data, util.options(opts), promise.fulfill); | ||
this.col.insert(data, util.options(opts), function (err, docs) { | ||
process.nextTick(function () { | ||
promise.fulfill.call(promise, err, docs ? docs[0] : docs); | ||
}); | ||
}); | ||
@@ -265,0 +269,0 @@ return promise; |
{ | ||
"name": "monk" | ||
, "version": "0.1.3" | ||
, "version": "0.1.4" | ||
, "main": "lib/monk.js" | ||
@@ -5,0 +5,0 @@ , "dependencies": { |
@@ -81,2 +81,17 @@ | ||
describe('inserting', function () { | ||
it('should force callback in next tick', function (done) { | ||
var p = users.insert({ a: 'b' }); | ||
p.complete(done); | ||
}); | ||
it('should give you an object with the _id', function (done) { | ||
var p = users.insert({ a: 'b' }, function (err, obj) { | ||
expect(obj._id).to.be.an('object'); | ||
expect(obj._id.toHexString).to.not.be(undefined); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('promises', function () { | ||
@@ -83,0 +98,0 @@ var Promise = monk.Promise; |
24568
2.97%751
2.32%