Releases: mongodb/node-mongodb-native
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!
v3.6.7
The MongoDB Node.js team is pleased to announce version 3.6.7 of the driver
Release Highlights
This patch addresses a number of bug fixes. Notably, there was an interesting javascript related issue with sorting documents. It only impacts users using numerical keys in their documents.
> { a: 'asc', [23]: 'asc' }
{ [23]: 'asc', a: 'asc' } // numbers come first
In javascript, numerical keys are always iterated first when looping over the keys of an object followed by the chronological specification of each string key. This effectively changes the ordering of a sort document sent to mongodb. However our driver does accept sort specification in a variety of ways and one way to avoid this problem is passing an array of tuples:
[['a', 'asc'], ['23', 'asc']]
This ensures that mongodb is sent the 'a'
key as the first sort key and '23'
as the second.
Bug Fixes
- NODE-3159: removing incorrect apm docs (#2793) (971259a)
- NODE-3173: Preserve sort key order for numeric string keys (#2790) (730f43a)
- NODE-3176: handle errors from MessageStream (#2774) (f1afcc4)
- NODE-3192: check clusterTime is defined before access (#2806) (6ceace6)
- NODE-3252: state transistion from DISCONNECTED (#2807) (5d8f649)
- NODE-3219: topology no longer causes close event (#2791) (16e7064)
- invalid case on writeconcern makes skip check fail (#2773) (b1363c2)
Documentation
- Reference: http://mongodb.github.io/node-mongodb-native/3.6
- 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 driver immediately, and report any issues to the NODE project.
Thanks very much to all the community members who contributed to this release!
v4.0.0-beta.3
The MongoDB Node.js team is pleased to announce version 4.0.0-beta.3 of the driver
This release brings us closer to the RC release for the fully typescript enabled version 4.0.0 of the driver.
You can expect a full migration and detailed list of changes with the upcoming RC.
All Changes
- always close gridfs upload stream on finish (#2759) (1c6f544)
- don't auto destroy read stream for Node 14 (d4e297e)
- move session support check to operation layer (#2750) (c19f296)
- remove existing session from cloned cursors (30ccd86)
- NODE-3071: Ignore error message if error code is defined (#2770) (d4cc936)
- NODE-3152: ensure AWS environment variables are applied properly (#2756) (341a602)
- add fermium to evergreen test runs (#2762) (2303b41)
Documentation
v3.6.6
The MongoDB Node.js team is pleased to announce version 3.6.6 of the driver
Release Highlights
This patch addresses a number of bugs listed below.
Most notably, for client side encryption users upgrading to this version of the driver along with the new version of [email protected] will alleviate the potential deadlock case if your connection pool was fully utilized. There will now be an internal MongoClient that will be used for metadata look ups (e.g, listCollections
) when the pool size is under certain constraints. The events generated from this client are forwarded to the client instance you initialize so it is possible to monitor all events.
Bug
- [NODE-2995] - Sharing a MongoClient for metadata lookup can lead to deadlock in drivers using automatic encryption
- [NODE-3050] - Infinite loop on Windows due to a bug in require_optional package
- [NODE-3120] - TypeError: Cannot read property 'roundTripTime' of undefined
- [NODE-3122] - Pipelining an upload stream of GridFSBucket never finishes on Node v14
- [NODE-3129] - Collection () .. .setReadPreference() not routing query to secondaries
- [NODE-3133] - autoEncryption produces serverHeartbeatFailed - with MongoError typemismatch
Improvement
- [NODE-3070] - Define error handling behavior of writeErrors and writeConcernError on Mongos
Documentation
- Reference: http://mongodb.github.io/node-mongodb-native/3.6
- 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 driver immediately, and report any issues to the NODE project.
Thanks very much to all the community members who contributed to this release!
v4.0.0-beta.2
The MongoDB Node.js team is pleased to announce version 4.0.0-beta.2 of the driver
This release brings us closer to the RC release for the fully typescript enabled version 4.0.0 of the driver.
You can expect a full migration and detailed list of changes with the upcoming RC.
Breaking Changes
All Changes
- add FLE AWS sessionToken TypeScript definitions (#2737) (f4698b5)
- remove catch for synchronous socket errors and remove validation on nodejs option (#2746) (a516903)
- session support detection spec compliance (#2733) (1615be0)
- remove deprecated items (#2740) (ee1a4d3)
- remove enums in favor of const objects (#2741) (d52c00e)
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
v3.6.5
The MongoDB Node.js team is pleased to announce version 3.6.5 of the driver!
Notable Fixes
In this patch there is a fix surrounding an issue some users were encountering in serverless environments when using the Unified Topology. If the nodejs process went unused for a great amount of time there was an intermittent issue that would cause startSession
to fail, however, issuing a dummy read request would resolve the problem. The session support check is now done after server selection meaning the driver has the most up to date information about the MongoDB deployment before utilizing sessions. We encourage any user's that implemented workarounds to updated their driver and make use of this fix.
In addition, the previous release of our driver added a warning about an upcoming change in the v4 version of the driver about how users can specify their write concern options. We've updated the driver to use nodejs's process.emitWarning
API in nearly all cases where the driver prints something out, as well as limit most warning messages to only be printed once.
Bug
- session support detection spec compliance (#2732) (9baec71)
- [NODE-3100] - startSession fails intermittently on servers that support sessions
- [NODE-3066] - Accessing non-existent property 'MongoError' of module exports inside circular dependency
- [NODE-3114] - Incorrect warning: Top-level use of w, wtimeout, j, and fsync is deprecated
- [NODE-3119] - Node 14.5.4, mongo 3.6.4 Circular warnings