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
merged 1 commit into from Apr 28, 2012

Conversation

Projects
None yet
2 participants
Collaborator

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
callback.

closes #725
9bbd873

@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
fc6b5d0

@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