-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
BREAKING CHANGE: use MongoDB node driver 6, drop support for rawResult
option and findOneAndRemove()
#13753
Conversation
…lt` option and `findOneAndRemove()`
i think this PR should be marked as |
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 👍
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.
mongodb 6.0.0 requires nodejs 16.20.1 or higher
also from bson release notes:
tests:
|
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.
some minor markdown things
Co-authored-by: hasezoey <[email protected]>
@hasezoey fixed, can you please re-review? |
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.
looks good to me now.
i dont know if it is related to this PR, but some replica set tests are timing out, and one test somehow tried to run while drop is occuring
…ic/mongoose into vkarpov15/mongodb-node-driver-6
@hasezoey I took a closer look and the test failures were indicative of a bug where we weren't passing |
Summary
Use the latest commits to MongoDB Node driver's 6.0 branch to make sure Mongoose is compatible. 3 big changes:
rawResult
option. This PR replacesrawResult
with theincludeResultMetadata
optionincludeResultMetadata
, we need to slightly restructure howorFail()
works onfindOneAndX()
. Specifically,orFail()
will now only error out whenfindOneAndX()
doesn't return a document; previously,orFail()
would also throw an error ifupsert
was set and a new document was upserted. WithincludeResultMetadata
, detecting whether a document was upserted or not is no longer possible in general. However, I think this new approach makes more sense, or at least the TypeScript types make more sense, because TS types treatorFail()
as making the query result non-nullable.findOneAndRemove()
.findOneAndRemove()
was just a legacy wrapper aroundfindOneAndDelete()
, didn't even have its own middleware.Examples