Skip to content

Commit 54db026

Browse files
committed
test(subdocument): repro #8223
1 parent 89eb449 commit 54db026

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/types.subdocument.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,16 @@ describe('types.subdocument', function() {
9292
}, {$set: thingy2});
9393
});
9494
});
95+
96+
describe('#isModified', function() {
97+
it('defers to parent isModified (gh-8223)', function() {
98+
const childSchema = Schema({ id: Number, text: String });
99+
const parentSchema = Schema({ child: childSchema });
100+
const Model = db.model('gh8223', parentSchema);
101+
102+
const doc = new Model({ child: { text: 'foo' } });
103+
assert.ok(doc.isModified('child.id'));
104+
assert.ok(doc.child.isModified('id'));
105+
});
106+
});
95107
});

0 commit comments

Comments
 (0)