Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NODE-4796)!: remove addUser and collection.stats APIs #3781

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Jul 21, 2023

Description

What is changing?

Removing deprecations

mongodb-js/nodejs-mongodb-legacy#22

Is there new documentation needed for these changes?

What is the motivation for this change?

Release Highlight

db.addUser() and admin.addUser() removed

The deprecate 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.

The associated options interface with this API has also been removed: AddUserOptions.

See createUser documentation: https://www.mongodb.com/docs/manual/reference/command/createUser/

const db = client.db('admin');
// Example addUser usage
await db.addUser(
  'myUsername', 
  'myPassword', 
  { roles: [ { role: 'readWrite', db: 'mflix' } ] }
);
// Example equivalent command usage
await db.command({ 
  createUser: 'myUsername', 
  pwd: 'myPassword', 
  roles: [ { role: 'readWrite', db: 'mflix' } ] 
});

collection.stats() removed

The collStats command is deprecated starting in server v6.2 so the driver is removing it's bespoke helper in this major release. The collStats command is still usable from manually running it via await db.command(). However, the recommended migration is to use the $collStats aggregation stage. You can find more information here: $collStats.

The associated interfaces with this API have also been removed: CollStatsOptions and WiredTigerData.

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@nbbeeken nbbeeken marked this pull request as ready for review July 21, 2023 18:17
@W-A-James W-A-James self-requested a review July 24, 2023 13:46
@W-A-James W-A-James self-assigned this Jul 24, 2023
Copy link
Contributor

@W-A-James W-A-James left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't flag all of them, but can we update the tests that got touched to use async syntax? Other than that, lgtm.

@@ -102,7 +101,7 @@ describe('URI', function () {

c.close(() => client.close(done));
});
});
}, done);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to convert this test to use async syntax?

@W-A-James W-A-James added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jul 24, 2023
@nbbeeken nbbeeken requested a review from W-A-James July 24, 2023 17:37
@W-A-James W-A-James added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jul 24, 2023
@baileympearson baileympearson merged commit e79ac9d into main Jul 25, 2023
1 check passed
@baileympearson baileympearson deleted the NODE-4796-removals branch July 25, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants