Skip to content

Commit

Permalink
test(document): repro #8251
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 18, 2019
1 parent c337999 commit efd08ef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/document.test.js
Expand Up @@ -8113,4 +8113,21 @@ describe('document', function() {
yield person.save();
});
});

it('setting single nested subdoc with timestamps (gh-8251)', function() {
const ActivitySchema = Schema({ description: String }, { timestamps: true });
const RequestSchema = Schema({ activity: ActivitySchema });
const Request = db.model('gh8251', RequestSchema);

return co(function*() {
const doc = yield Request.create({
activity: { description: 'before' }
});
doc.activity.set({ description: 'after' });
yield doc.save();

const fromDb = yield Request.findOne().lean();
assert.equal(fromDb.activity.description, 'after');
});
});
});

0 comments on commit efd08ef

Please sign in to comment.