From 7dd2aaf92572d5d0e96f9bcb1af52972281f7402 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 28 Jul 2021 11:44:09 -0400 Subject: [PATCH] test(document): repro #10449 --- test/document.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/document.test.js b/test/document.test.js index 48135a4ac2c..51b88f7f042 100644 --- a/test/document.test.js +++ b/test/document.test.js @@ -10469,4 +10469,20 @@ describe('document', function() { } }); + it('does not pull non-schema paths from parent documents into nested paths (gh-10449)', function() { + const schema = new Schema({ + name: String, + nested: { + data: String + } + }); + const Test = db.model('Test', schema); + + return co(function*() { + const doc = new Test({}); + doc.otherProp = 'test'; + + assert.ok(!doc.nested.otherProp); + }); + }); });