Skip to content

Commit 75a0e6b

Browse files
Ethan Cellettirstam
Ethan Celletti
authored andcommitted
CSHARP-2459: Not outputting port to '+srv' urls
Having an issue with turning a mongourl to as string then re-parsing it. There is validation on parsing that the port cant be defined with '+srv' but the ToString() outputs the port
1 parent e47850f commit 75a0e6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MongoDB.Driver/MongoUrlBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ public override string ToString()
753753
foreach (MongoServerAddress server in _servers)
754754
{
755755
if (!firstServer) { url.Append(","); }
756-
if (server.Port == 27017)
756+
if (server.Port == 27017 || _scheme == ConnectionStringScheme.MongoDBPlusSrv)
757757
{
758758
url.Append(server.Host);
759759
}

0 commit comments

Comments
 (0)