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

fix(query): convert findOneAndUpdate to findOneAndReplace when overwrite set for backwards compat with Mongoose 6 #13572

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #13550

Summary

In Mongoose 6, findOneAndUpdate() with overwrite: true was converted into findOneAndReplace(). Looks like that behavior got lost in some of our callback refactoring work for Mongoose 7. This PR adds that behavior back.

What do you think about deprecating the overwrite option? It is no longer necessary with findOneAndReplace(), and is a potential source of confusion.

Examples

Unverified

This user has not yet uploaded their public signing key.
…ite set for backwards compat with Mongoose 6

Fix #13550
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.

What do you think about deprecating the overwrite option? It is no longer necessary with findOneAndReplace(), and is a potential source of confusion.

sounds good to me

@vkarpov15 vkarpov15 added this to the 7.3.2 milestone Jul 4, 2023
@vkarpov15 vkarpov15 merged commit aa5c2c2 into master Jul 4, 2023
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-13550 branch July 4, 2023 18:31
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.

.toObject() has different behavior from 6.x to 7.x
2 participants