Skip to content

Commit

Permalink
test(query): repro #4836
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 2, 2017
1 parent 22552c5 commit d1492ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion test/model.populate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4640,7 +4640,6 @@ describe('model: populate:', function() {
return Person.populate(luke, { path: 'parent', model: 'gh4843' });
}).
then(function(luke) {
console.log('test', luke);
assert.equal(luke.parent.name, 'Anakin');
done();
}).
Expand Down
22 changes: 22 additions & 0 deletions test/query.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,26 @@ describe('query middleware', function() {
});
});
});

it('error handlers with findOneAndUpdate and passRawResult (gh-4836)', function(done) {
var schema = new Schema({name: {type: String}});

var called = false;
var errorHandler = function(err, res, next) {
called = true;
next();
};

schema.post('findOneAndUpdate', errorHandler);

var Person = db.model('Person', schema);

Person.
findOneAndUpdate({name: 'name'}, {}, {upsert: true, passRawResult: true}).
exec(function(error) {
assert.ifError(error);
assert.ok(!called);
done();
});
});
});

0 comments on commit d1492ce

Please sign in to comment.