- 
    Type:Bug 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    Affects Version/s: 2.12.0
- 
    Component/s: Cluster Management
- 
    None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
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.