The MongoDB Node.js team is pleased to announce version 4.7.0 of the mongodb package! Happy MongoDB World Day!
Release Highlights
Support for ZSTD Compression
zstd compression is now supported by the NodeJS driver. To enable zstd compression, add it as a dependency in your project: npm install –save @mongodb-js/zstd. The add the option to your URI options: mongodb://host:port/db?compressors=zstd.
Improved Connection Storm Avoidance
The Node driver has improved connection storm avoidance by limiting the number of connections that the driver will attempt to open to each server at a time. The number of concurrent connection attempts is set to 2 by default, but can be configured with a new MongoClient argument, maxConnecting. The following code example creates a new MongoClient that configures maxConnecting to 5.
const client = new MongoClient('MONGODB_URL', { maxConnecting: 5 });
Expanded Change Stream Events
The collection.watch function now supports a new option, showExpandedEvents. When showExpandedEvents is enabled, change streams will report the following events on servers 6.0 and later:
createIndexes
dropIndexes
modify
create
shardCollection
On servers 6.1.0 and later, showExpandedEvents will also show change stream events for the following commands:
reshardCollection
refineCollectionShardKey
As an example, the following code creates a change stream that has expanded events enabled on a collection:
const client = new MongoClient('MONGODB_URL');
await client.connect();
Change streams now support pre and post images for update events. To enable pre and post images, the collection must be created with the changeStreamPreAndPostImages option enabled:
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Updates the requirements on mongodb to permit the latest version.
Release notes
Sourced from mongodb's releases.
... (truncated)
Changelog
Sourced from mongodb's changelog.
... (truncated)
Commits
1cc2c4b
chore(release): 4.7.0c8362eb
test: resumability for change stream unified tests (#3282)9c1782e
feat(NODE-4196): add support for showExpandedEvents in change streams (#3254)ed50ef5
test(NODE-4262): simplify leak checker for startSession fixes (#3281)0936b58
chore: skip failing TS version (#3285)7a5d2f5
chore: add generated docs files to release commit (#3283)6cae4b4
test(NODE-4270): convert command monitoring tests to unified format (#3276)f8e7301
chore(NODE-4285): rename csfle shared library references (#3280)4501a1c
fix(NODE-4281): ensure that the driver always uses Node.js timers (#3275)47adfb3
feat(NODE-4081): fix and deprecate change stream resume options (#3270)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)