Skip to content

Conversation

@nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Nov 7, 2025

Description

Summary of Changes

Move the server selection in connect into the skipPing section which will make it not run for operations that are causing the MongoClient to connect for the first time.

Notes for Reviewers
  • The session support check now needs to run after server selection in execute operation because there is now a case (auto-connect) where we've never selected a server before. However, it has always been true that this check was being run on an arbitrarily stale server description.

What is the motivation for this change?

Remove redundancy in the auto-connect path

Release Highlight

Remove extra server selection in auto-connect

When running an operation (ex. insertOne) on a new MongoClient that hasn't been connected yet the first server selection performed will now be for that operation.

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 November 7, 2025 22:17
Comment on lines +208 to +213
if (
session?.snapshotEnabled &&
maxWireVersion(topology) < MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION
) {
throw new MongoCompatibilityError('Snapshot reads require MongoDB 5.0 or later');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When this check was done by ServerCapabilities it was written as

this.maxWireVersion >= 13;

Which is the opposite right? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant