We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d373c81 commit 4ff5f52Copy full SHA for 4ff5f52
test/document.test.js
@@ -4768,6 +4768,26 @@ describe('document', function() {
4768
});
4769
4770
4771
+ it('handles array defaults correctly (gh-5780)', function(done) {
4772
+ var testSchema = new Schema({
4773
+ nestedArr: {
4774
+ type: [[Number]],
4775
+ default: [[0, 1]]
4776
+ }
4777
+ });
4778
+
4779
+ var Test = db.model('gh5780', testSchema);
4780
4781
+ var t = new Test({});
4782
+ assert.deepEqual(t.toObject().nestedArr, [[0, 1]]);
4783
4784
+ t.nestedArr.push([1, 2]);
4785
+ var t2 = new Test({});
4786
+ assert.deepEqual(t2.toObject().nestedArr, [[0, 1]]);
4787
4788
+ done();
4789
4790
4791
it('Single nested subdocs using discriminator can be modified (gh-5693)', function(done) {
4792
var eventSchema = new Schema({ message: String }, {
4793
discriminatorKey: 'kind',
0 commit comments