I'm using Mongo with C# mongo driver(2.10).
I've managed to connect to it via a replica set via :
var dbClient = new MongoClient(
"mongodb://aaa:123@m.com:27017,m1.com:37017,m2.com:47017/dbtest?safe=true&connect=replicaset");
But then I read that I don't need to indicate connect=replicaset
because I have multiple hosts.
Which is the opposite of what have been suggested here.
So now my connection is :
"mongodb://aaa:123@m.com:27017,m1.com:37017,m2.com:47017/dbtest?safe=true"
— it works.
But then I read the docs (and also here),and there is no connect=replicaset
switch at all.
All there is the: replicaset=name
switch.
Question:
What is the right way of declaring connection string (to be used with MongoClient C#) which uses a replica set ?