2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.