title: Why I'm getting up to 4 open connections to my mongo database?
body: <p>My first time using Spring and I'm trying to develop an RESTful API. Using <code>Spring Data MongoDB</code> with <code>MongoRepository</code>, I would want to know why on my log are appearing up to 4 opened connections:</p>
  
  <pre><code>[  restartedMain] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
  [127.0.0.1:27017] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:1}] to 127.0.0.1:27017
  [127.0.0.1:27017] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=127.0.0.1:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 4, 4]}, minWireVersion=0, maxWireVersion=5, maxDocumentSize=16777216, roundTripTimeNanos=1907739}
  [  restartedMain] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
  [localhost:27017] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:2}] to localhost:27017
  [localhost:27017] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 4, 4]}, minWireVersion=0, maxWireVersion=5, maxDocumentSize=16777216, roundTripTimeNanos=1145793}
  [  restartedMain] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:3, serverValue:3}] to localhost:27017
  [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
  [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
  [ restartedMain] org.mongodb.driver.connection : Opened connection [connectionId{localValue:4, serverValue:4}] to 127.0.0.1:27017
  </code></pre>
  
  <p>My mongo configuration: </p>
  
  <pre><code>@Configuration
  @EnableMongoRepositories(basePackages="com.api.repo")
  class MongoConfig extends AbstractMongoConfiguration {
  
      @Value("${spring.data.mongodb.host}")
      private String url;
      @Value("${spring.data.mongodb.port}")
      private int port;
      @Value("${spring.data.mongodb.database}")
      private String db;
  
      @Override
      protected String getDatabaseName() {
          return db;
      }
  
      @Override
      public Mongo mongo() throws Exception {
  
  //      return new Fongo("meh").getMongo();
          return new MongoClient(url, port);
      }
  
      @Override
      protected Collection&lt;String&gt; getMappingBasePackages() {
          return Arrays.asList("com.api");
      }
  </code></pre>