Skip to content

Commit 41ad80a

Browse files
committed
test(document): repro #7907
1 parent 5e7ab25 commit 41ad80a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/document.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7292,6 +7292,22 @@ describe('document', function() {
72927292
assert.equal(doc.nested.prop, '3');
72937293
});
72947294

7295+
it('supports setting date properties with strict: false (gh-7907)', function() {
7296+
const schema = Schema({}, { strict: false });
7297+
const SettingsModel = db.model('gh7907', schema);
7298+
7299+
const date = new Date();
7300+
const obj = new SettingsModel({
7301+
timestamp: date,
7302+
subDoc: {
7303+
timestamp: date
7304+
}
7305+
});
7306+
7307+
assert.strictEqual(obj.timestamp, date);
7308+
assert.strictEqual(obj.subDoc.timestamp, date);
7309+
});
7310+
72957311
it('handles .set() on doc array within embedded discriminator (gh-7656)', function() {
72967312
const pageElementSchema = new Schema({
72977313
type: { type: String, required: true }

0 commit comments

Comments
 (0)