Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[ready] fix subdoc validation error paths #871

merged 1 commit into from Apr 28, 2012


None yet
2 participants

aheckmann commented Apr 28, 2012

subdocument validation error paths were reported incorrectly.

var plan = new Schema({ title: { type: 'string', required: true }})
var room = new Schema({ lessonplans: [plan] });
var r = new Room({ lessonplans: [{ title: '' }] });
r.save(function (err) {
  // old incorrect behavior
  console.log(err.errors.title) // Validator "required" ...
  // corrected behavior
  console.log(err.errors['lessonplans.0.title']) // Validator "required" ...

closes #725

@aheckmann aheckmann fix subdoc validation error paths
subdoc validation errors are now bubbled up to their
parent document and no longer passed to their local

closes #725

@rauchg rauchg added a commit that referenced this pull request Apr 28, 2012

@rauchg rauchg Merge pull request #871 from aheckmann/fixSubDocErrorPaths
[ready] fix subdoc validation error paths

@rauchg rauchg merged commit fc6b5d0 into Automattic:master Apr 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment