-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(NODE-3765): make replacement for replaceOne operations without _id #3040
Conversation
6d30520
to
f4085ac
Compare
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.
Thanks so much for your help here! I think we can take this in a bit more of a strict direction
f4085ac
to
3553fe4
Compare
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, (test failures are unrelated and already are fixed on main)
…ations The _id field is immutable in a replaceOne operation, so it does not make sense to require passing it. Also, this makes replaceOne consistent with insertOne.
3553fe4
to
e865c09
Compare
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 wanted to follow up on this orphaned comment
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!
Description
What is changing?
collection.replaceOne
,collection.findOneAndReplace
and thereplaceOne
bulk operation now take aWithoutId<TModel>
type for the replacement document.Is there new documentation needed for these changes?
I don’t think so. It should be self-documented from the tsdoc.
What is the motivation for this change?
_id
field is immutable, so it shouldn’t be required as it has to be the same value when passed.replaceOne
more in line withinsertOne
.Double check the following
npm run check:lint
script<type>(NODE-xxxx)<!>: <description>