Skip to content

Commit

Permalink
test(query): repro #8268
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 23, 2019
1 parent 068e57a commit d7ceb89
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3569,12 +3569,18 @@ describe('Query', function() {
});
});

it('query with top-level _bsontype (gh-8222)', function() {
it('query with top-level _bsontype (gh-8222) (gh-8268)', function() {
const userSchema = Schema({ token: String });
const User = db.model('gh8222', userSchema);

return User.create({ token: 'rightToken' }).
then(() => User.findOne({ token: 'wrongToken', _bsontype: 'a' })).
then(doc => assert.ok(!doc));
return co(function*() {
const original = yield User.create({ token: 'rightToken' });
let doc = yield User.findOne({ token: 'wrongToken', _bsontype: 'a' });
assert.ok(!doc);

doc = yield User.findOne(original._id);
assert.ok(doc);
assert.equal(doc.token, 'rightToken');
});
});
});

0 comments on commit d7ceb89

Please sign in to comment.