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

latest releases: 6.6.0-dev.20240504.sha.2609953, 6.6.0, 6.5.0-dev.20240503.sha.7f191cf...
2 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.