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)) {