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

[#8093] Fixes performance of update validator, and flatten function logic #8191

Closed
wants to merge 3 commits into from

Conversation

birdofpreyru
Copy link
Contributor

Fixes #8093

Before this commit the flatten(..) function failed to deliver what it promised. Namely, it entered into Mixed paths of objects.

The update validator, on its side, did not pass the casted doc schema into flatten(..). If the casted doc contained a large Mixed field, all its paths were added into the list of updated paths. They were lated ignored by now removed check for schemaPath type, but performance was already hurt.

This commit makes sure that inner sub-paths of Mixed paths are not included into the array of paths at all, thus no further checks of that are necessary, and the performance is restored.

…function logic

Before this commit the `flatten(..)` function failed to deliver what it
promised. Namely, it entered into Mixed paths of objects.

Update validator, on its side, did not pass the casted doc schema into
`flatten(..)`. If the casted doc contained a large Mixed field, all its
paths were added into the list of updated paths. They were lated ignored
by now removed check for schemaPath type, but performance was already
hurt.

This commit makes sure that inner sub-paths of Mixed paths are not
included into the array of paths at all, thus no further checks of that
are necessary, and the performance is restored.

Fixes Automattic#8093
@birdofpreyru birdofpreyru deleted the fix-8093 branch September 23, 2019 22:33
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.

runValidators: true for findOneAndUpdate is orders of magnitude slower than save().
1 participant