Skip to content

Releases: mongodb/node-mongodb-native

v4.0.1

20 Jul 20:55
ac52605
Compare
Choose a tag to compare

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

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.

v4.0.0

13 Jul 17:37
ead7920
Compare
Choose a tag to compare

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)

Features (since beta.6)

Bug Fixes

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.

v3.6.10

06 Jul 19:45
1297cd1
Compare
Choose a tag to compare

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

Documentation

We invite you to try the mongodb package immediately, and report any issues to the NODE project.

v4.0.0-beta.6

01 Jul 17:00
a4e14ff
Compare
Choose a tag to compare
v4.0.0-beta.6 Pre-release
Pre-release

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 in findOneAndUpdate()
  • 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

Features

Bug Fixes

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.

v4.0.0-beta.5

26 May 21:53
f066b13
Compare
Choose a tag to compare
v4.0.0-beta.5 Pre-release
Pre-release

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

Documentation

We invite you to try the mongodb package immediately, and report any issues to the NODE project.

v3.6.9

26 May 21:18
394832a
Compare
Choose a tag to compare

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

Documentation

We invite you to try the mongodb package immediately, and report any issues to the NODE project.

v3.6.8

21 May 17:25
6c8cc84
Compare
Choose a tag to compare

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

We invite you to try the mongodb package immediately, and report any issues to the NODE project.

v4.0.0-beta.4

18 May 18:41
3a2ea28
Compare
Choose a tag to compare
v4.0.0-beta.4 Pre-release
Pre-release

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

Features

Bug Fixes


Documentation

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 mongodb@4.0.0-beta.4

Thanks very much to all the community members who contributed to this release!

v3.6.7

18 May 19:25
4fd03e8
Compare
Choose a tag to compare

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

Documentation

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

06 Apr 19:28
d477e2e
Compare
Choose a tag to compare

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

Documentation