-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Remove overwrite
option for updateOne()
, findOneAndUpdate()
, etc.
#13989
Conversation
…ndUpdate to findOneAndReplace Re: #13578
overwrite
option for updateOne()
, findOneAndUpdate()
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM minus the failing typescript test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but there are some things missing:
remove(seems like optionoverwrite
option from typescript typesoverwrite
never even existed in the types)- add changelog entry about removal
the current typescript types ci failing is not related to this PR, it has been introduced into the 8.0 branch by 81cba56
@hasezoey can you re-review please? |
Summary
Re: #13578, remove the
overwrite
option for 8.0. In 7.x,Model.findOneAndUpdate(filter, update, { overwrite: true })
becomes afindOneAndReplace()
, which is a vestigial quirk of back whenupdate()
with no atomic operators would overwrite the document. Given that's no longer the case, we don't really need anoverwrite
option anymore.Removed a few tests that relied on
overwrite: true
.Examples