On this page
On this page, you can learn about any changes you might need to make to your application to upgrade your driver to a new version without loss of functionality.
Before you upgrade, perform the following actions:
Ensure the new driver version is compatible with the MongoDB Server version your application connects to and the version of Node.js that your application runs on. See the Compatibility page for this information.
Address any breaking changes between the version of the driver your application currently uses and your planned upgrade version in the Breaking Changes section of this guide. To learn more about the MongoDB Server release compatibility changes, see the Server Release Compatibility Changes section.
You can minimize the amount of changes that you need to make to your application when upgrading driver versions by using the Stable API.
A breaking change is a modification in a convention or behavior in a specific version of the driver that may prevent your application from working as expected.
The breaking changes in this section are categorized by the major version releases that introduced them. When upgrading driver versions, address all the breaking changes between your current version and the planned upgrade version.
Driver versions 4.x are not compatible with Node.js v12.8 or earlier. If you want to use this version of the driver, You must use Node.js v12.9 or greater.
Cursortypes no longer extend
You cannot use a
ChangeStreaminstance as an iterator after using it as an
EventEmitter. You also cannot do the reverse—using an
EventEmitterinstance as an iterator after using it as a
The following methods no longer accept a callback parameter:
The default value of the
maxPoolSizeconnection option is now
The driver no longer supports the
gssapiServiceNameKerberos option. Users should use
The driver no longer accepts non-boolean types, such as
1, for boolean options.
db.collectiontype no longer accepts a callback.
Dbtype is no longer an
EventEmitter. You can listen to any events directly from the
The driver removes support for the
The driver no longer includes the deprecated
For more information about these changes, see the v4.0 changelog.
A server release compatibility change is a modification to the driver that discontinues support for a set of MongoDB Server versions.
The driver discontinues support for a MongoDB Server version after it reaches end-of-life (EOL).
To learn more about the MongoDB support for EOL products, see the Legacy Support Policy.
The v4.2 driver drops support for MongoDB Server v3.4 and earlier. To use the v4.2 driver, your MongoDB Server must be v3.6 or later. To learn how to upgrade your MongoDB Server to v3.6, follow the link that corresponds to your MongoDB deployment configuration: