Skip to content

Commit

Permalink
test(document): repro #5780
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 4, 2017
1 parent d373c81 commit 4ff5f52
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4768,6 +4768,26 @@ describe('document', function() {
});
});

it('handles array defaults correctly (gh-5780)', function(done) {
var testSchema = new Schema({
nestedArr: {
type: [[Number]],
default: [[0, 1]]
}
});

var Test = db.model('gh5780', testSchema);

var t = new Test({});
assert.deepEqual(t.toObject().nestedArr, [[0, 1]]);

t.nestedArr.push([1, 2]);
var t2 = new Test({});
assert.deepEqual(t2.toObject().nestedArr, [[0, 1]]);

done();
});

it('Single nested subdocs using discriminator can be modified (gh-5693)', function(done) {
var eventSchema = new Schema({ message: String }, {
discriminatorKey: 'kind',
Expand Down

0 comments on commit 4ff5f52

Please sign in to comment.