From cc10e0dc441f469330c1af2822d171fcd6fa8f89 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 9 Oct 2019 18:27:30 -0400 Subject: [PATCH] test(query): repro #8222 --- test/query.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/query.test.js b/test/query.test.js index 5a67e45eb32..ba5bd1efadc 100644 --- a/test/query.test.js +++ b/test/query.test.js @@ -3550,4 +3550,13 @@ describe('Query', function() { }); }); }); + + it('query with top-level _bsontype (gh-8222)', 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)); + }); });