diff --git a/lib/model.js b/lib/model.js index a868f309..aeb57e16 100644 --- a/lib/model.js +++ b/lib/model.js @@ -215,6 +215,8 @@ AbstractClass.create = function (data, callback) { }, data); }, data); } + + return obj; }; function stillConnecting(schema, obj, args) { diff --git a/test/manipulation.test.js b/test/manipulation.test.js index 723e2770..8c4a3a9b 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -37,6 +37,16 @@ describe('manipulation', function() { }); }); + it('should return instance of object', function(done) { + var person = Person.create(function(err, p) { + p.id.should.eql(person.id); + done(); + }); + should.exist(person); + person.should.be.an.instanceOf(Person); + should.not.exist(person.id); + }); + it('should work when called without callback', function(done) { Person.afterCreate = function(next) { this.should.be.an.instanceOf(Person);