[Snyk] Upgrade mongodb from 3.7.3 to 4.3.1 #7
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.7.3 to 4.3.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.3.1 of the mongodb package!
Release Highlights
In this patch release, we address the limitation introduced in 4.3.0 with the dot notation Typescript improvements and recursive types.
Namely, this fix removes compilation errors for self-referential types.
Note that this fix still has the following limitations:
any
after the first level of recursion for self-referential typesnext: Node | null;
}
declare const collection: Collection<Node>;
// no error here even though
next
is of typeNode | null
collection.find({
next: {
next: 'asdf'
}
});
b: B;
}
interface B {
a: A;
}
declare const mutuallyRecursive: Collection<A>;
// this will throw an error because there is indirect recursion
// between types (A depends on B which depends on A and so on)
mutuallyRecursive.find({});
Bug Fixes
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.3.0 of the mongodb package!
Release Highlights
This release includes SOCKS5 support and a couple of other important features and bug fixes that we hope will improve your experience with the node driver.
The SOCKS5 options can be configured via the
proxyHost
,proxyPort
,proxyPassword
andproxyUsername
options in the connection string passed to theMongoClient
instance. Big thanks to @ addaleax for helping with this feature!The other notable features address performance and TypeScript as detailed below.
Performance
The original release of the 4.x driver relied on a new version of the BSON library that enables UTF-8 validation by default, resulting in noticeable performance degradation over the 3.x driver when processing over string data. This release introduces an option to opt out of this validation by specifying
enableUtf8Validation: false
at the client, database, collection, or individual operation level.For example:
const client = new MongoClient('mongodb://localhost:27017', { enableUtf8Validation: false });
// disable UTF-8 validation for a particular operation
const client = new MongoClient('mongodb://localhost:27017');
const db = client.db('database name');
const collection = db.collection('collection name');
await collection.find({ name: 'John Doe'}, { enableUtf8Validation: false });
TypeScript
Type inference for nested documents
Thanks to an amazing contribution from @ avaly we now have support for key auto-completion and type hinting on nested documents! MongoDB permits using dotted keys to reference nested keys or specific array indexes within your documents as a shorthand for getting at keys beneath the top layer. Typescript's Template Literal types allow us to take the interface defined on a collection and calculate at compile time the nested keys and indexes available.
For example:
name: string;
age: number;
}
interface Pet {
name: string
bestFriend: Human
}
const pets = client.db().collection<Pet>('pets');
await pets.findOne({ 'bestFriend.age': 'young!' }) // typescript error!
Here's what autocomplete suggests in VSCode:
WARNING: There is a known shortcoming to this feature: recursive types can no longer be used in your schema. For example, an interface that references itself or references another schema that references back to the root schema cannot be used on our
Collection
generic argument. Unlike at runtime where a "recursive" shaped document has an eventual stopping point we don't have the tools within the language to declare a base case enumerating nested keys. We hope this does not cause friction when upgrading driver versions: please do not hesitate to reach out with any feedback you have about this feature.Consistent type inference for the _id type
We have also enhanced the type inference for the
_id
type. Now, when performing operations on a collection, the following holds true based on the type of the schema:_id
is specified on the schema, it is inferred to be of typeObjectId
and is optional on inserts._id
is specified on the schema as required, then the_id
type is inferred to be of the specified type and is required on inserts._id
is specified on the schema as optional, it is inferred to be of the specified type and is optional on inserts: this format is intended to be used with thepkFactory
option in order to ensure a consistent_id
is assigned to every new document.Features
enableUtf8Validation
option (#3074) (4f56409)Bug Fixes
GridFSBucketWriteStream.prototype.end()
returnthis
for compat with @ types/[email protected] (#3088) (7bb9e37)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.2.2 of the mongodb package!
Bug Fixes
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.2.1 of the mongodb package!
Release Highlights
This release fixes an issue with the dbName being overridden by the authSource option. Additionally, we have ensured that cursors re-run server selection when fetching additional batches, which should reduce issues encountered in long running function as a service environments.
Bug Fixes
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
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