-
Notifications
You must be signed in to change notification settings - Fork 23
feat: Add mongodb v5 support with strict filter types #422
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
Conversation
| "@typescript-eslint/no-unsafe-argument": "warn", | ||
| "@typescript-eslint/no-unsafe-assignment": "warn", | ||
| "@typescript-eslint/no-unsafe-member-access": "warn", | ||
| "@typescript-eslint/no-unsafe-return": "warn", |
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.
For some weird reason, the ESLint TS plugin now thinks the type of the update filter variables are any, so let's temporarily downgrade these to warning.
|
Agreed on the major version bump. |
|
What is the TL;DR on the difference between |
|
|
Oh, well that is not bad, so they just decided to isolate the support for dot-notation fields in its own type instead of removing it completely? |
dde1686 to
662b5ad
Compare
From looking at the changes, I'm having trouble understanding what this would break in external applications. However, since this does involve a major version upgrade of the |
e5a4947 to
e592470
Compare
|
Worth pinning to 5.0.1? https://github.com/mongodb/node-mongodb-native/releases/tag/v5.0.1 (or is that moot with the peerDep set) |
e592470 to
0534bb7
Compare
|
I updated our dev dependency to 5.0.1, but given the peer dependency version is more of an indicator of breaking changes which we depend on, I'll keep that version declared as |
|
|
||
| Papr is using the strict types to provide type safety for all query and update filters. | ||
|
|
||
| This comes with a caveat: whenever you need to interact with the `mongodb` driver collections, you need to cast filter types to their simple counterparts, since `Filter` is not compatible with `StrictFilter`. |
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.
This bit of the docs is very nicely written, well done!
0534bb7 to
ab1e0e4
Compare
ab1e0e4 to
bba476a
Compare
BREAKING CHANGE: `mongodb` v5 is required as a peer dependency. BREAKING CHANGE: `Filter` and `UpdateFilter` types are now using the strict counterpart types from mongodb v5.
bba476a to
73b7148
Compare
This PR adds support for
mongodbv5.Together with this we're switching to the
StrictFiltertypes.Because this is changing the implementation of the internal types and has potential to break existing applications, I think this should be a major version bump. Happy to hear other arguments though.
mongodbto5.0.0StrictFiltertypesStrictUpdateFiltertypes