I have a mongo (2.0.3) replica set.
If I connect to a specific node (i.e. my connection string does not include more than one host) using the standard c# driver, and specify slaveOk(), will that query be satisfied by a random member of the set, or only ever by the node I connected to?
If the former, how can I achieve the latter?
Thank you.
If your connection string only has one host name (and does not have either replicaSet=name or connect=replicaSet) the C# driver will connect in direct mode to that one server and use only it.
Replica set semantics (where it uses the whole set) is triggered either by listing more than one host name (called the seed list), or by using replicaSet=name or connect=replicaSet.
So if you want to use just that one host you are on the right track. You will have to specify slaveOk on the connection string or the connect will fail if that server is not the primary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With