Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

441
Views
No server chosen by WritableServerSelector from cluster description ClusterDescription

I am able to execute command from terminal. I have this simple java program

public static void main(String s[]) {
    new MongoDb();     
}

public MongoDb() {
    MongoClient mongoClient = MongoClients.create();//"mongodb://127.0.0.1:27017");
    MongoDatabase database = mongoClient.getDatabase("mqtt");  
    addMqttUser(database);
}

public void addMqttUser(MongoDatabase database) {
    MongoCollection<Document> collection = database.getCollection("restaurants");        
    Document document = new Document("name", "mqtt_user")
                   .append("username", "test22")
                   .append("is_superuser", false)
                   .append("password", "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3");
    collection.insertOne(document, new SingleResultCallback<Void>() {
        @Override
        public void onResult(final Void result, final Throwable t) {
            System.out.println("Inserted!");
        }
    });         
}

I am getting this in my log

11:16:07,842  INFO cluster:71 - Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
11:16:07,991  INFO cluster:71 - No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out

I am using 3.4.1 version of mongodb

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!