node-mongodb-native
node-mongodb-native copied to clipboard
fix(NODE-7229): remove duplicate server selection when auto-connecting
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
- [x] Lint is passing (
npm run check:lint) - [x] Self-review completed using the steps outlined here
- [x] PR title follows the correct format:
type(NODE-xxxx)[!]: description- Example:
feat(NODE-1234)!: rewriting everything in coffeescript
- Example:
- [x] Changes are covered by tests
- [ ] New TODOs have a related JIRA ticket