Skip to content

v4.0.0-beta.4

Pre-release
Pre-release
Compare
Choose a tag to compare
@nbbeeken nbbeeken released this 18 May 18:41
· 67 commits to 4.0 since this release
3a2ea28

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 [email protected]

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