Skip to content

Ensure update validators only call validators underneath single nested paths once #15446

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

Merged
merged 2 commits into from
May 30, 2025

Conversation

vkarpov15
Copy link
Collaborator

Fix #15436

Summary

Examples

@vkarpov15 vkarpov15 added this to the 8.15.2 milestone May 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses issue #15436 by ensuring that update validators for single nested paths are only called once.

  • Added tests to verify the behavior for both type casting and update validation in nested documents.
  • Updated the update validators helper to mark single nested paths as already validated.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/types/models.test.ts Added a test function (gh15437) to validate schema hydration.
test/model.updateOne.test.js Introduced a new test ensuring validators under single nested docs are called only once.
lib/helpers/updateValidators.js Updated logic to flag single nested paths as already validated.

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though it also seems to include the changes from #15443.

@vkarpov15 vkarpov15 merged commit da2c5dd into master May 30, 2025
74 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-15436 branch May 30, 2025 20:50
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.

Validation in sub documents are triggerred multiple times on update
3 participants