Browse files

fixed; [] and Array cast to Mixed by default

  • Loading branch information...
1 parent a8c1b8a commit 8fce78a20ba9ab6da14004cedc6902fdc18db95b @aheckmann aheckmann committed Mar 22, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/mongoose/schema.js
View
6 lib/mongoose/schema.js
@@ -129,7 +129,11 @@ Schema.prototype.path = function (path, obj) {
this.paths[path] = new Types.Mixed(path, obj);
else if (Array.isArray(type) || type == Array){
// if it was specified through { type } look for `cast`
- var cast = type == Array ? obj.cast : type[0];
+ var cast = type == Array
+ ? obj.cast
+ : type[0];
+
+ cast = cast || Types.Mixed;
if (cast instanceof Schema)
this.paths[path] = new Types.DocumentArray(path, cast, obj);

0 comments on commit 8fce78a

Please sign in to comment.