Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.12.0
-
None
Description
Start mongod like:
mongod --replSet test
|
and try to send a command:
MongoClient mongo = new MongoClient(new MongoClientURI("mongodb://localhost:27001")); |
CommandResult result = mongo.getDB("admin").command("ping"); |
It fails with this exception:
Exception in thread "main" com.mongodb.MongoServerSelectionException: Unable to connect to any servers
|
The root cause is that ClusterDescription.getAny() only returns server descriptions where isPrimary || isSecondary is true.