Releases: mongodb/node-mongodb-native
v3.6.11
The MongoDB Node.js team is pleased to announce version 3.6.11 of the mongodb package!
Release Highlights
This patch addresses a few bugs listed below.
Notably, we fixed an issue with the way we imported one of our optional dependencies that blocked webpack bundling.
If you are a webpack user you will still get warnings for our optional dependencies (if you don't use them).
You can hush the warnings by adding this option to your webpack config:
{
// ...
externals: [
'mongodb-client-encryption',
'aws4',
'saslprep',
'kerberos',
'snappy',
'bson-ext',
],
// ...
}
It is important to note that this will leave the imports in place and not pull in the code to your bundle. If you later do adopt using these dependencies you'll want to revert the relevant setting.
Bug Fixes
- NODE-1843: bulk operations ignoring provided sessions (#2898) (9244b17)
- NODE-3199: unable to bundle driver due to uncaught require (#2903) (60efe9d)
Documentation
- Reference: https://docs.mongodb.com/drivers/node/current/
- API: http://mongodb.github.io/node-mongodb-native/3.6/api
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/3.6/HISTORY.md
We invite you to try the mongodb package immediately, and report any issues to the NODE project.
v4.1.0
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
- NODE-2843: implement sessions advanceClusterTime method (#2920) (1fd0244)
- NODE-3011: Load Balancer Support (#2909) (c554a7a)
Bug Fixes
- NODE-2883: Aggregate Operation should not require parent parameter (#2918) (dc6e2d6)
- NODE-3058: accept null or undefined anywhere we permit nullish values (#2921) (b42a1b4)
- NODE-3441: fix typings for createIndexes (#2915) (f87f376)
- NODE-3442: AsyncIterator has incorrect return type (#2916) (4a10389)
- NODE-3452: readonly filters not permitted by typings (#2927) (ce51e78)
- NODE-3510: omit incorrect
| void
in declaration of Promise overload ofrename()
(#2922) (58c1e84) - NODE-3513: default command monitoring to off (#2926) (3c60245)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
v4.0.1
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:
- Webpack will no longer throw an error when trying to bundle the driver
- Snapshot sessions will now correctly apply the snapshot time when initiated with a distinct operation
We hope this improves your upgrade experience!
Bug Fixes
- NODE-3199: unable to bundle driver due to uncaught require (#2904) (9e48bbd)
- NODE-3393: snapshot time not applied if distinct executed first (#2908) (7aa3008)
- NODE-3417: allow calling
db()
before MongoClient is connected (#2889) (51ea86d)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
v4.0.0
The MongoDB Node.js team is delighted to announce the major version release 4.0.0 of the MongoDB Node.js Driver!
Release Highlights
We finally did it! The major version release of the MongoDB driver is now generally available! This release represents over a year's worth of effort that couldn't have been done without stellar contributions from the community and our Node.js DBX team. We hope you give it a try and are able to upgrade smoothly! 🎉
The biggest news is our migration to Typescript 🥳 offering first class support of type definitions in the driver itself.
Some cool new MongoDB 5.0 features now supported in the driver are:
- Native support for Time Series Collections
- Time series collections efficiently store sequences of measurements over a period of time. Compared to normal collections, storing time series data in time series collections improves query efficiency and reduces the disk usage for time series data and secondary indexes
- Snapshot reads on secondaries
- Support for read concern level "snapshot" (non-speculative) for read commands outside of transactions, including on secondaries. The snapshot reads on secondaries feature allows users to perform analytics with snapshot isolation on dedicated secondaries, including long running snapshot reads.
Below are only the changes since our last beta release, for the full set of breaking changes look at the upgrade guide here and for the full set of new features, take a look here.
⚠ BREAKING CHANGES (since beta.6)
- NODE-3427: remove md5 hashing from GridFS API (#2899) (a488d88)
- NODE-1797: error when ChangeStream used as iterator and emitter concurrently (#2871) (e0b3afe)
- AND MORE!
Features (since beta.6)
- NODE-3095: add timeseries options to db.createCollection (#2878) (c145c91)
- NODE-3392: enable snapshot reads on secondaries (#2897) (523e05c)
- NODE-3403: define MongoRuntimeError children (#2894) (cb0db49)
- NODE-3410: added MongoRuntimeError (#2892) (ee903cb)
- AND MORE!
Bug Fixes
- NODE-1797: error when ChangeStream used as iterator and emitter concurrently (#2871) (e0b3afe)
- NODE-1843: bulk operations ignoring provided sessions (#2868) (70810d1)
- NODE-3063: fix custom csfle test script (#2884) (d73c80c)
- NODE-3279: use "hello" for monitoring if supported (#2895) (5a8842a)
- NODE-3386: listCollections result type definition (#2866) (c12979a)
- NODE-3413: accept tls=false in mongodb+srv connection strings (#2886) (526c73f)
- NODE-3416: make change stream generic default to Document (#2882) (3d490dc)
- NODE-3430: watch method types on MongoClient and Db (#2900) (17cc291)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
v3.6.10
The MongoDB Node.js team is pleased to announce version 3.6.10 of the mongodb package!
Release Highlights
This patch addresses a few bugs listed below. Notably the bsonRegExp
option is now respected by the underlying BSON library, you can use this to decode regular expressions that contain syntax not permitted in native JS RegExp objects. Take a look at this example:
await collection.insertOne({ a: new BSONRegExp('(?-i)AA_') })
await collection.findOne({ a: new BSONRegExp('(?-i)AA_') }, { bsonRegExp: true })
// { _id: ObjectId, a: BSONRegExp { pattern: '(?-i)AA_', options: '' } }
Also there was an issue with Cursor.forEach
where user defined forEach callbacks that throw errors incorrectly handled catching errors. Take a look at the comments in this example:
collection.find({}).forEach(doc => {
if(doc.bad) throw new Error('bad document!');
}).catch(error => {
// now this is called! and error is `bad document!`
})
// before this fix the `bad document!` error would be thrown synchronously
// and have to be caught with try catch out here
Bug Fixes
- NODE-2035: Exceptions thrown from awaited cursor forEach do not propagate (#2852) (a917dfa)
- NODE-3150: added bsonRegExp option for v3.6 (#2843) (e4a9a57)
- NODE-3358: Command monitoring objects hold internal state references (#2858) (750760c)
- NODE-3380: perform retryable write checks against server (#2861) (621677a)
- NODE-3397: report more helpful error with unsupported authMechanism in initial handshake (#2876) (3ce148d)
Documentation
- Reference: https://docs.mongodb.com/drivers/node/current/
- API: http://mongodb.github.io/node-mongodb-native/3.6/api
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/3.6/HISTORY.md
We invite you to try the mongodb package immediately, and report any issues to the NODE project.
v4.0.0-beta.6
The MongoDB Node.js team is pleased to announce version 4.0.0-beta.6 of the mongodb package!
Release Highlights
This is on the larger side of the beta releases we've done so far we're getting closer to calling this version official.
As a breaking change in this release we now make use of the new MongoDriverError
and MongoServerError
to clarify where the issue arose from. All of the errors that our driver throws subclass from MongoError
so its possible to filter in catch blocks using instanceof
. Take a look at this example:
// without calling .connect()
await c.insertOne({ a: 1 })
// Uncaught MongoDriverError: MongoClient must be connected before calling MongoClient.prototype.db
// at MongoClient.db (lib/mongo_client.js)
await c.insertOne({ _id: /a/ })
// Uncaught MongoServerError: can't use a regex for _id
// at lib/operations/insert.js {
// index: 0,
// code: 2
// }
Here's the highlights:
- BSON-EXT support is back! Make sure you use bson-ext v4 with the driver v4.
- Our typescript got some big upgrades, you should get hinting and completion for filters in
.find()
and update specifiers infindOneAndUpdate()
- If you store regular expressions in mongodb from another language where the symbols are not supported in native JS regexes, you can now set the bsonRegExp flag to retrieve them
await collection.insertOne({ a: new BSONRegExp('(?-i)AA_') })
await collection.findOne({ a: new BSONRegExp('(?-i)AA_') }, { bsonRegExp: true })
// { _id: ObjectId, a: BSONRegExp { pattern: '(?-i)AA_', options: '' } }
⚠ BREAKING CHANGES
- NODE-3291: Standardize error representation in the driver (#2824)
- NODE-3272: emit correct event type when SRV Polling (#2825)
- NODE-2752: remove strict/callback mode from Db.collection helper (#2817)
Features
- NODE-2751: add arrayFilters builder to bulk FindOperators (#2820) (d099622)
- NODE-3274: add type hinting for UpdateFilter (#2842) (05035eb)
- NODE-3325: support 'let' option for aggregate command (#2828) (e38838e)
- NODE-3331: offer downleveled types for legacy typescript versions (#2859) (27cf1d2)
- NODE-3333: support 'let' option for CRUD commands (#2829) (0d91da1)
Bug Fixes
- NODE-1502: command monitoring objects hold internal state references (#2832) (a2887db)
- NODE-2026: SERVICE_REALM kerberos mechanism property not attached (#2865) (5caa354)
- NODE-2035: exceptions thrown from awaited cursor forEach do not propagate (#2835) (ac49df6)
- NODE-2905: support SERVICE_NAME authentication mechanism property (#2857) (dfb91b8)
- NODE-2944: Reintroduce bson-ext support (#2823) (8eb0081)
- NODE-3150: allow retrieving PCRE-style RegExp (ca9e2dc)
- NODE-3272: emit correct event type when SRV Polling (#2825) (579119f)
- NODE-3305: beforeHandshake flag is always true (#2854) (079bd6c)
- NODE-3311: InsertOneOptions extends CommandOperationOptions (#2816) (734b481)
- NODE-3335: do not validate explain verbosity in client (#2834) (1a57ba8)
- NODE-3343: allow overriding result document after projection applied (#2856) (988f9c8)
- NODE-3356: update redaction logic for command monitoring events (#2849) (536e5ff)
- NODE-3291: Standardize error representation in the driver (#2824) (9608c6a)
- NODE-2752: remove strict/callback mode from Db.collection helper (#2817) (53abfe7)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
v4.0.0-beta.5
The MongoDB Node.js team is pleased to announce version 4.0.0-beta.5 of the driver!
Release Highlights
This release further improves our TypeScript support with consistent enum naming and a better list of exported types.
Bug Fixes
- NODE-3183, NODE-3249: bring versioned API impl up to date (#2814) (cd3b73a)
- NODE-3245: mark symbols as internal remove from type definitions (#2810) (0b636ba)
- NODE-3275: Fix enum type export naming and serverApi validation (#2809) (661511d)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the mongodb package immediately, and report any issues to the NODE project.
v3.6.9
The MongoDB Node.js team is pleased to announce version 3.6.9 of the driver!
Release Highlights
This release fixes a major performance bug in bulk write operations, which was inadvertently introduced by an incomplete code change in the previous release. The bug resulted in redundant array iterations and caused exponential increases in bulk operation completion times. Thank you Jan Schwalbe for bringing this to our attention!
Bug Fixes
- NODE-3309: remove redundant iteration of bulk write result (#2815) (fac9610)
- NODE-3234: fix url parsing for a mongodb+srv url that has commas in the database name (#2789) (58c4e69)
Documentation
- Reference: https://docs.mongodb.com/drivers/node/current/
- API: http://mongodb.github.io/node-mongodb-native/3.6/api
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/3.6/HISTORY.md
We invite you to try the mongodb package immediately, and report any issues to the NODE project.
v3.6.8
The MongoDB Node.js team is pleased to announce version 3.6.8 of the mongodb package!
Release Highlights
Thanks to the quick adoption of the previous new patch by the mongoose package (Automattic/mongoose#10265) a small bug was identified when connections to mongodb would timeout causing unnecessary clean up operations to run. Thank you @vkarpov15!
Bug Fixes
Documentation
- Reference: https://docs.mongodb.com/drivers/node/current/
- API: http://mongodb.github.io/node-mongodb-native/3.6/api
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/3.6/HISTORY.md
We invite you to try the mongodb package immediately, and report any issues to the NODE project.
v4.0.0-beta.4
The MongoDB Node.js team is pleased to announce version 4.0.0.beta.4 of the driver.
Release Highlights
This beta release brings optional support for Typescript generics when defining your collections
// Example:
interface Pet {
type: 'cat' | 'dog' | 'fish'
}
const collection = db.collection<Pet>()
await collection.findOne({}).toArray() // returns Pet[]
as well as strong typing for events emitted by the MongoClient
. For example, when listening to .on('commandStarted' event => ...)
, event
here will be a CommandStartedEvent
object.
We have a few breaking changes listed below, notably the node driver now aligns with other drivers by using the returnDocument
option when determining whether to return the document before
or after
the update in findOneAndUpdate
and findOneAndReplace
.
⚠ BREAKING CHANGES
- NODE-1812: replace returnOriginal with returnDocument option (#2803)
- NODE-3157: update find and modify interfaces for 4.0 (#2799)
- NODE-2978: remove deprecated bulk ops (#2794)
Features
- NODE-3115: Add generic parameterization (#2767) (4d12491)
- NODE-3132: Add TypedEventEmitter (#2785) (f4d40a4)
Bug Fixes
-
NODE-2995: Add shared metadata MongoClient (#2772) (9073d54)
-
NODE-3074: update estimated document count for v1 api (#2764) (146791c)
-
NODE-3109: prevent servername from being an IP (#2771) (27089be)
-
NODE-3166: allowInvalidHostnames and allowInvalidCertificates flags are ignored (#2784) (a769cf8)
-
NODE-3174: Preserve sort key order for numeric string keys (#2788) (440de41)
-
NODE-3176: handle errors from MessageStream (#2780) (76b110e)
-
NODE-3194: Ignore undefined and null options in MongoClient constructor (#2800) (8bb92f9)
-
NODE-3197: revert setImmediate in waitQueue (#2802) (6c0dfef)
-
NODE-3206: Make distinct use any[] type instead of Document[] (#2795) (b45e3b3)
-
NODE-3219: topology no longer causes close event (#2792) (6cd982f)
-
NODE-1812: replace returnOriginal with returnDocument option (#2803) (1cdc8a8)
-
NODE-3157: update find and modify interfaces for 4.0 (#2799) (29512da)
Documentation
- Reference: https://docs.mongodb.com/drivers/node
- API: https://mongodb.github.io/node-mongodb-native/4.0
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md
We invite you to try the driver immediately, and report any issues to the NODE project.
To try the beta use the following command:
npm install [email protected]
Thanks very much to all the community members who contributed to this release!