-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
refactor: upgrade mongodb from 3.6.11 to 4.1.1 #7586
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Snyk has created this PR to upgrade mongodb from 3.6.11 to 4.1.1. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr
Thanks for opening this pull request!
|
Codecov Report
@@ Coverage Diff @@
## master #7586 +/- ##
==========================================
- Coverage 93.98% 86.37% -7.61%
==========================================
Files 181 181
Lines 13354 13354
==========================================
- Hits 12551 11535 -1016
- Misses 803 1819 +1016
Continue to review full report at Codecov.
|
mtrezza
changed the title
[Snyk] Upgrade mongodb from 3.6.11 to 4.1.1
refactor: upgrade mongodb from 3.6.11 to 4.1.1
Oct 8, 2021
3 tasks
4 tasks
Closing, as upgrade was made via #7794. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade mongodb from 3.6.11 to 4.1.1.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Warning: This is a major version upgrade, and may be a breaking change.
Release notes
Package name: mongodb
The MongoDB Node.js team is pleased to announce version 4.1.1 of the mongodb package!
Release Highlights
Error handling
We introduced better organization and consistency to our existing errors in an effort to provide more detailed error types that can help identify issues clearly and quickly. Our readme has a new section that describes how to handle errors thrown by the driver and defines our approach to semver in the context of errors. Notably, we recommend only using
instanceof
checks to filter for a given error class as we do not guarantee error messages or names will be preserved between patch releases, only the subclass hierarchy.Thanks so much to our summer interns @ andymina and @ W-A-James for undertaking this effort!
Notable fixes
findOne()
once again correctly returnsnull
when no match is found instead ofundefined
. This change was unintentional and not consistent with our other APIs. It slipped through testing due to the nature ofundefined
andnull
being nearly (==
) but not actually (===
) equal. We apologize if this results in the need for any code changes.This release also addresses some Typescript issues that require further explanation, let's dive in:
TypeScript support
Projections
Starting in MongoDB 4.4 projections can accept aggregation expressions and aggregation syntax.
This empowers users to create some pretty amazing and complex data model transformations on the database side.
Unfortunately, our initial release of typescript typing for projections was too narrow to allow these use cases and still pass the compiler checks.
Now projections are generic objects and the result of a cursor with a projection is typed as a generic object by default.
The recommended usage for projections alongside typescript is as follows:
name: string;
buddies: Pet[];
}
interface PetBuddyCount {
name: string;
buddyCount: number;
}
const pets = db.collection<Pet>('pets');
const petBuddyCounts = await pets.find().project<PetBuddyCount>({
name: 1,
buddyCount: { $size: '$buddies' },
}).toArray();
By using a parameterized
.project
call you can now get the correct type information on thepetBuddyCounts
array.You will need to build the projection type yourself based on the projection you define for your query, but this has the benefit of constraining your results to precisely your type expectations.
Generics in find/findOne
In our initial typescript release the
find
andfindOne
methods accepted a generic parameter that was passed to the filter argument of the API.Due to how typescript automatically resolves the types of generics, one could run into an issue when specifying a filter that was incorrectly typed.
The code below should be a Typescript error, TS hints to us the
name
is astring
so it should only allow an array ofstring
for$in
.It uses the incorrectly typed filter that does not match the schema of
Filter<TSchema>
to automatically resolve a crazy return type.The function definition has now been updated to be:
So the Filter argument will no longer be automatically resolved to the passed in type, giving us the typescript compiler errors we love so much!
Bug Fixes
Refactoring
Documentation
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
The MongoDB Node.js team is pleased to announce version 4.1.0 of the mongodb package!
Release Highlights
This release includes load balancer support, intended for use with the beta Serverless platform. When using the driver with Serverless, the SRV URI will automatically put the driver into this mode. When wanting to use a non-SRV URI one must add the
loadBalanced=true
option to the URI to put the driver into this mode. Being in this mode enables the driver to properly route transactions and cursors to the correct service behind the load balancer.The release also fixes an important bug where the original release of the v4 driver enabled command monitoring by default, which caused many reported observations of performance degradation when upgrading from v3 of the driver. Command monitoring is now once again disabled by default and must be enabled by passing in
{ monitorCommands: true }
to the client if desired.Features
Bug Fixes
| void
in declaration of Promise overload ofrename()
(#2922) (58c1e84)Documentation
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
The MongoDB Node.js team is pleased to announce version 4.0.1 of the mongodb package!
Release Highlights
This release fixes two small but important bugs from our 4.0.0 release:
We hope this improves your upgrade experience!
Bug Fixes
db()
before MongoClient is connected (#2889) (51ea86d)Documentation
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
Read more
Read more
Read more
Read more
Commit messages
Package name: mongodb
Compare
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs