Skip to content

Commit

Permalink
test(query): repro #7418
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 17, 2019
1 parent 42d7aee commit ded7dab
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/query.middleware.test.js
Expand Up @@ -568,4 +568,19 @@ describe('query middleware', function() {
done();
});
});

it('doesnt double call post(regexp) with updateOne (gh-7418)', function() {
const schema = new Schema({ name: String });
let calledPost = 0;

schema.post(/.*/, function(res, next) {
++calledPost;
next();
});

const Test = db.model('gh7418', schema);

return Test.updateOne({}, { name: 'bar' }).
then(() => assert.equal(calledPost, 1));
});
});

0 comments on commit ded7dab

Please sign in to comment.