LearnBoost/mongoose — Issue #725: subdocument validation error paths are incorrect
Author: aheckmann
Created: 2012-02-08 16:56:38+00:00
State: open

```js
var sub = new Schema({ title: { type: String, required: true }});
var par = new new Schema({ subs: [sub] })
var Par = db.model('Par', par);

var p = new Par;
p.subs.push({ });

p.save(function (err) {
console.log(err)
// { stack: [Getter/Setter],
// message: 'Validation failed',
// name: 'ValidationError',
// errors:
// { title:
// { stack: [Getter/Setter],
// message: 'Validator "required" failed for path title',
// name: 'ValidatorError',
// path: 'title',
// type: 'required' } } }
})
```

path should be `subs.title`