yarn mongodb 4.0.0-beta.4
v4.0.0-beta.4

latest releases: 6.10.0-dev.20241101.sha.5e6638a2, 6.10.0-dev.20241031.sha.f62c45d2, 6.10.0-dev.20241024.sha.5c4355ad...
3 years ago

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!

Don't miss a new mongodb release

NewReleases is sending notifications on new releases.