Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ready] fix subdoc validation error paths #871

Merged
merged 1 commit into from Apr 28, 2012
Merged

[ready] fix subdoc validation error paths #871

merged 1 commit into from Apr 28, 2012

Conversation

aheckmann
Copy link
Collaborator

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

subdoc validation errors are now bubbled up to their
parent document and no longer passed to their local
callback.

closes #725
rauchg added a commit that referenced this pull request Apr 28, 2012
[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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

subdocument validation error paths are incorrect
2 participants