Reputation: 5507
I have a quick questions here. I am using mongodb with C# and Java. Connectionstring that i use is:
mongodb.domain.com/?autoConnectRetry=true
The same connection string is working with Java but not with C#. I saw many posts around this that, if we remove autoConnectRetry option it works fine.
Looked at the logs and saw that its erroring out with below exception
System.ArgumentException: Invalid option 'autoConnectRetry'.
Parameter name: url
at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
at MongoDB.Driver.MongoUrl..ctor(String url)
at MongoDB.Driver.MongoUrl.Create(String url)
at MongoDB.Driver.MongoServer.Create(String connectionString)
Is there any alternative that can make this work?
I am using .NET Framework 3.5 and Mongodb C# driver v 1.0
Upvotes: 2
Views: 723
Reputation: 101533
There is just no such option ("autoConnectRetry") in C# MongoDb driver, while there is in Java, so you will have to implement retry logic yourself. If you just want to use the same connection string for both and don't care about retry logic - I think that in current version of the driver it no longer throws InvalidOperationException on unknown options.
Upvotes: 1