If you explicitly use new MongoDbBuilder().WithUsername(null).WithPassword(null), the code will now default to using mongo for the username and password, and if you use empty string instead of null, a runtime error is throwing saying these fields are required, which means it is now impossible to use no-authentication mode out of the box.
Solution
Provide a property on MongoDbConfiguration called useDefaultCredentials that defaults to true to preserve current behavior, but can be set to false to get the desired behavior.
Benefit
This allows for running mongodb in replica set mode without having to set up the extra bits that are required when authentication is enabled, and having an explicit feature to not use the default credentials will hopefully prevent a regression
Alternatives
I can only think of workarounds, not alternatives
Would you like to help contributing this enhancement?
Problem
The 3.0 release broke MongoDb no-authentication mode, which makes replica set mode easier to use (see https://github.com/testcontainers/testcontainers-dotnet/issues/538)
If you explicitly use
new MongoDbBuilder().WithUsername(null).WithPassword(null)
, the code will now default to usingmongo
for the username and password, and if you use empty string instead of null, a runtime error is throwing saying these fields are required, which means it is now impossible to use no-authentication mode out of the box.Solution
Provide a property on MongoDbConfiguration called
useDefaultCredentials
that defaults totrue
to preserve current behavior, but can be set tofalse
to get the desired behavior.Benefit
This allows for running mongodb in replica set mode without having to set up the extra bits that are required when authentication is enabled, and having an explicit feature to not use the default credentials will hopefully prevent a regression
Alternatives
I can only think of workarounds, not alternatives
Would you like to help contributing this enhancement?
Yes