title: Change default Mongo connection pool size in spring-boot
body: <p><strong>I want to change the default size of connection pool provided by java mongodb driver</strong> which is 100 according to mongo docs.</p>
  
  <p>Below is the mongo client bean which I used to customize the connection pool size (refered <a href="https://stackoverflow.com/questions/24557774/mongo-connection-poolingchanging-the-size-of-connection-pool">this question</a>). I set both min and max connectionPerHost attributes to 1 and ran 10 parallel worker threads which interact with the DB to make sure that my change is applied. </p>
  
  <pre><code>@Bean
  public Mongo mongo() throws Exception {
      MongoClientOptions.Builder clientOptions = new MongoClientOptions.Builder();
      clientOptions.minConnectionsPerHost(1);
      clientOptions.connectionsPerHost(1);
      MongoClient mongoClient = new MongoClient(new MongoClientURI(env.getProperty("mongodbhost"), clientOptions));
      return mongoClient;
  }
  </code></pre>
  
  <p>Then I calculated the starting and ending time spots of each worker thread. So that I know for sure the threads are working parallely and my connection pool size haven't changed by these configuration.
  Could anyone help me to get through this please? any help would be highly appreciated!</p>