Skip to content

Commit

Permalink
I believe it fixes #1245
Browse files Browse the repository at this point in the history
If there is EmbeddedDocument inside array, it's not wise to set property `path` ot it. At least because it may already have defined property with such name.
  • Loading branch information
bratchenko committed Dec 11, 2012
1 parent ccf9043 commit 04d7d61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/schema/array.js
Expand Up @@ -46,7 +46,9 @@ function SchemaArray (key, cast, options) {
var caster = cast.name in Types ? Types[cast.name] : cast;
this.casterConstructor = caster;
this.caster = new caster(null, castOptions);
this.caster.path = key;
if ('EmbeddedDocument' !== this.caster.constructor.name) {
this.caster.path = key;
}
}

SchemaType.call(this, key, options);
Expand Down

0 comments on commit 04d7d61

Please sign in to comment.