Permalink
Browse files

fixed; Mixed can now default to empty arrays

  • Loading branch information...
1 parent 18d7f13 commit bacfbcd484a973e92ae431d4d6082a94d328d4dc @aheckmann aheckmann committed Mar 23, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/mongoose/schema/mixed.js
@@ -14,6 +14,14 @@ var SchemaType = require('../schematype');
*/
function Mixed (path, options) {
+ // make sure empty array defaults are handled
+ if (options &&
+ options.default &&
+ Array.isArray(options.default) &&
+ 0 === options.default.length) {
+ options.default = Array;
+ }
+
SchemaType.call(this, path, options);
};

0 comments on commit bacfbcd

Please sign in to comment.