private List<MongoClientWrapper> getMongoClient(List<ConnectionString> shardSet) { mongoClients = new ArrayList<>(); try { for (ConnectionString address : shardSet) { com.mongodb.reactivestreams.client.MongoClient client = MongoClients.create(address); mongoClients.add(new MongoClientWrapper(address.getConnectionString(), client)); Thread.sleep(100); // allow the client to establish prior to being } } catch (InterruptedException e) { e.printStackTrace(); } return mongoClients; }
public static synchronized MongoClient getMongoClient() { if (mongoClient == null) { mongoClient = MongoClients.create(getConnectionString()); Runtime.getRuntime().addShutdownHook(new ShutdownHook()); } return mongoClient; }
@Override public MongoClient mongoClient() { return MongoClients.create(String.format("mongodb://%s:%d", mongoProperties.getHost(), mongoProperties.getPort())); }
@Override public MongoClient mongoClient() { return MongoClients.create(); }
@Override public MongoClient reactiveMongoClient() { return MongoClients.create(mongoUri); }
public MongoClient mongoClient() { return MongoClients.create(String.format("mongodb://localhost:%d", mongoProperties.getPort())); }
@Override @Bean @DependsOn("embeddedMongoServer") public MongoClient mongoClient() { return MongoClients.create(String.format("mongodb://localhost:%d", mongoProperties.getPort())); }
@Override public MongoClient reactiveMongoClient() { return MongoClients.create("mongodb://localhost/"+getDatabaseName()); }
@Override public MongoClient mongoClient() { return MongoClients.create(url); }
@Override public MongoClient mongoClient() { // this assumes your MongoDB is running on the default port, i.e. 27017 return MongoClients.create(); }
@Override public MongoClient reactiveMongoClient() { return MongoClients.create(url); }
@Bean MongoClient mongoClient() { return MongoClients.create(); }