-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.21.0
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Summary
The MongoUrlBuilder creates a query string with incorrect separators - ';' instead of '&'.
Driver version 2.21.0
How to Reproduce
Create a new .NET console app with top-level statements and paste the following:
using System; using MongoDB.Driver; using MongoDB.Driver.Core.Configuration; var builder = new MongoUrlBuilder(); builder.Scheme = ConnectionStringScheme.MongoDB; builder.Server = new MongoServerAddress("myserver"); builder.Username = "user"; builder.Password = "password"; builder.AuthenticationMechanism = "DEFAULT"; builder.AuthenticationSource = "mydatabase"; Console.WriteLine(builder.ToMongoUrl());
Expected output:
mongodb://user:password@myserver/?authMechanism=DEFAULT&authSource=mydatabase
Actual output:
mongodb://user:password@myserver/?authMechanism=DEFAULT;authSource=mydatabase
If I paste the actual output into e.g. Compass, it gives an error indicating that DEFAULT;authSource=mydatabase is not a valid value for authMechanism.
Additional Background
Please provide any additional background information that may be helpful in diagnosing the bug.