From b56c9495b9d32b69c72abc68ae01e951285e5050 Mon Sep 17 00:00:00 2001 From: Aaron Heckmann Date: Sun, 3 Feb 2013 10:04:16 -0800 Subject: [PATCH] fixed; { path: [{type: "String" }] } --- lib/schema/array.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/schema/array.js b/lib/schema/array.js index 83455ed2dcf..a22a286f4ab 100644 --- a/lib/schema/array.js +++ b/lib/schema/array.js @@ -44,7 +44,15 @@ function SchemaArray (key, cast, options) { } } - var caster = cast.name in Types ? Types[cast.name] : cast; + // support { type: 'String' } + var name = 'string' == typeof cast + ? cast + : cast.name; + + var caster = name in Types + ? Types[name] + : cast; + this.casterConstructor = caster; this.caster = new caster(null, castOptions); if (!(this.caster instanceof EmbeddedDoc)) {