This is my connection string
MongoClient _client = MongoClients.create("mongodb://" +
UserName + ":" + Password + "@" +
"sales-shard-00-00.8yajj.mongodb.net:27017," +
"sales-shard-00-01.8yajj.mongodb.net:27017," +
"sales-shard-00-02.8yajj.mongodb.net:27017/" + DbName +
"&authSource=admin&retryWrites=true&w=majority");
and this is the debug’s log…
I/System.out: 23:04:56.973 [main] INFO org.mongodb.driver.cluster - Cluster created with settings {hosts=[sales-shard-00-00.8yajj.mongodb.net:27017, sales-shard-00-01.8yajj.mongodb.net:27017, sales-shard-00-02.8yajj.mongodb.net:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
23:04:56.977 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-00.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:56.994 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-01.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:56.996 [main] INFO org.mongodb.driver.cluster - Adding discovered server sales-shard-00-02.8yajj.mongodb.net:27017 to client view of cluster
I/System.out: 23:04:57.000 [main] DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=UNKNOWN, servers=[{address=sales-shard-00-01.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, {address=sales-shard-00-00.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}, {address=sales-shard-00-02.8yajj.mongodb.net:27017, type=UNKNOWN, state=CONNECTING}]
I/System.out: 23:04:57.134 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-02.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:3}
I/System.out: 23:04:57.135 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-01.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:2}
I/System.out: 23:04:57.135 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-00.8yajj.mongodb.net:27017] DEBUG org.mongodb.driver.connection - Closing connection connectionId{localValue:1}
I/System.out: 23:04:57.137 [cluster-ClusterId{value='61d221880fa89e1599d43ca6', description='null'}-sales-shard-00-01.8yajj.mongodb.net:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server sales-shard-00-01.8yajj.mongodb.net:27017
com.mongodb.MongoSocketReadException: Prematurely reached end of stream
and then the project stuck when i try to insert a record in a collection !
why ?
thanks
Alberto.