v6.0.0
6.0.0 (2023-08-28)
The MongoDB Node.js team is pleased to announce version 6.0.0 of the mongodb-legacy
package!
Release Notes
Adopt MongoDB Node.js Driver v6
v6.0.0 of this package depends on driver version ^6.0.0
. It can be used to migrate existing callback using codebases to promises incrementally while pulling in the latest and greatest MongoDB has to offer!
Minimum Node.js version is now v16.20.1
The minimum supported Node.js version is now v16.20.1. We strive to keep our minimum supported Node.js version in sync with the runtime's release cadence to keep up with the latest security updates and modern language features.
db.addUser()
and admin.addUser()
removed
The deprecated addUser
APIs have been removed. The driver maintains support across many server versions and the createUser
command has support for different features based on the server's version. Since applications can generally write code to work against a uniform and perhaps more modern server, the path forward is for applications to send the createUser
command directly.
See the createUser
documentation for more information.
const db = client.db('admin');
// Example addUser usage
db.addUser(
'myUsername',
'myPassword',
{ roles: [ { role: 'readWrite', db: 'mflix' } ] },
(error) => {
if (error) {
console.log('Failed to create user', error);
return;
}
console.log('Created user!');
}
);
// Example equivalent command usage
db.command(
{
createUser: 'myUsername',
pwd: 'myPassword',
roles: [ { role: 'readWrite', db: 'mflix' } ]
},
(error) => {
if (error) {
console.log('Failed to create user', error);
return;
}
console.log('Created user!');
}
);
collection.stats()
removed
The collStats
command is deprecated starting in server v6.2 so the driver is removing its bespoke helper in this major release. The collStats
command is still available to run manually via await db.command()
. However, the recommended migration is to use the $collStats
aggregation stage.
⚠ BREAKING CHANGES
- NODE-5585: adopt mongodb driver v6 (#26)
- NODE-5432: remove addUser and collection.stats (#22)
- NODE-5416: bump minimum Node.js version to v16.20.1 (#18)
Documentation
We invite you to try the mongodb-legacy
library immediately, and report any issues to the NODE project.