From 56fb748282cc66cf54c9ad58b4ef5b017fe27495 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Sun, 23 Aug 2020 15:44:43 -0400 Subject: [PATCH] test: repro #9350 --- test/model.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/model.test.js b/test/model.test.js index 6fcfb2ca6f2..9d0e705e4da 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -6869,6 +6869,23 @@ describe('Model', function() { }); }); + it('allows calling `create()` after `bulkWrite()` (gh-9350)', function() { + const schema = Schema({ foo: Boolean }); + const Model = db.model('Test', schema); + + return co(function*() { + yield Model.bulkWrite([ + { insertOne: { document: { foo: undefined } } }, + { updateOne: { filter: {}, update: { $set: { foo: true } } } } + ]); + + yield Model.create({ foo: undefined }); + + const docs = yield Model.find(); + assert.equal(docs.length, 2); + }); + }); + describe('returnOriginal (gh-9183)', function() { const originalValue = mongoose.get('returnOriginal'); beforeEach(() => {