Skip to content

Support mongodb+srv connection string in connection test tool#1841

Open
alcaeus wants to merge 2 commits intomongodb:v2.xfrom
alcaeus:connect-tool-support-srv
Open

Support mongodb+srv connection string in connection test tool#1841
alcaeus wants to merge 2 commits intomongodb:v2.xfrom
alcaeus:connect-tool-support-srv

Conversation

@alcaeus
Copy link
Member

@alcaeus alcaeus commented Feb 5, 2026

I had GitHub Copilot implement this while I was busy with other things. I successfully tested this with one of my Atlas clusters.

@alcaeus alcaeus requested a review from jmikola February 5, 2026 13:27
@alcaeus alcaeus requested a review from a team as a code owner February 5, 2026 13:27
Copilot AI review requested due to automatic review settings February 5, 2026 13:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for mongodb+srv:// connection strings to the connection test tool by implementing DNS SRV record resolution. Previously, the tool only supported standard mongodb:// connection strings and had a TODO comment for SRV support.

Changes:

  • Implemented SRV record resolution via new getHostsFromSrv() function
  • Added proper scheme validation and handling for both mongodb:// and mongodb+srv:// protocols
  • Updated SSL detection logic to default to enabled for SRV connections per MongoDB specification

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.91%. Comparing base (0ca802a) to head (f171efb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               v2.x    #1841   +/-   ##
=========================================
  Coverage     87.91%   87.91%           
  Complexity     3208     3208           
=========================================
  Files           428      428           
  Lines          6390     6390           
=========================================
  Hits           5618     5618           
  Misses          772      772           
Flag Coverage Δ
6.0-replica_set 86.71% <ø> (ø)
6.0-server 82.76% <ø> (ø)
6.0-sharded_cluster 86.49% <ø> (ø)
8.0-replica_set 87.77% <ø> (ø)
8.0-server 83.53% <ø> (ø)
8.0-sharded_cluster 87.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alcaeus alcaeus force-pushed the connect-tool-support-srv branch from 810bcda to f171efb Compare February 5, 2026 13:35
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

Nice.
I'll let you decide how relevant these refactorings are.

Co-authored-by: Jérôme Tamarelle <jerome@tamarelle.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants