Skip to content

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Oct 7, 2025

Description

Summary of Changes

Run checkout always in connect

Notes for Reviewers

What is the motivation for this change?

Release Highlight

Improve MongoClient.connect() consistency across environments

The MongoClient connect function will now run a handshake regardless of credentials being defined. The upshot of this change is that connect is more consistent at verifying some fail-fast preconditions regardless of environment. For example, previously, if connecting to a loadBalanced=true cluster without authentication there would not have been an error until a command was attempted.

Release notes highlight

Double check the following

  • Lint is passing (npm run check:lint)
  • 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 requested a review from a team as a code owner October 7, 2025 16:12
@durran durran self-assigned this Oct 8, 2025
@durran durran added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Oct 8, 2025
durran
durran previously approved these changes Oct 8, 2025
@durran durran added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Oct 8, 2025
@dariakp dariakp requested a review from baileympearson October 8, 2025 20:34
Copy link
Contributor

@baileympearson baileympearson left a comment

Choose a reason for hiding this comment

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

just a couple of questions

Comment on lines 597 to 598
* An optional method to verify a typical set of preconditions before using a MongoClient.
* For detailed information about the connect process see the MongoClient.connect static method documentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest just copying the doc comment from MongoClient.connect(). Or reworking this a bit.

But the phrasing "to verify a typical set of preconditions" feels odd (and also - typical set of preconditions for who and what, exactly?).

Alternatively, since I expect users primarily use the instance connect and not the static connect, we could just move the docs from the static method here and just link the static method's documentation to this.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did try to link and api-extractor throws because the syntax is abiguous, you have to use tsdoc syntax which means you need to add a new flag to typedoc to get it to link properly. Probably something worth looking into adding if linking around to other docs would be valuable.

I can move the docs to the instance or the static or copy them on to both?

updated the preconditions bit


it(
'does not checkout connection when authentication is disabled',
'checks out connection to confirm connectivity even when authentication is disabled',
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just combine this test with the one above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean by combine? because one is auth disabled and the other one is enabled, how are they combinable unless you want to move the metadata filter check into the test?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no longer a difference in behavior when auth is enabled or disabled, right? So we don't need two tests. One test that runs with both auth enabled and disabled is sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right of course it'll run in both without the filter

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