title: Connections from mongoose createConnection not getting closed. Multi tenant app
body: <p>I've been creating a multi tenant app where I've been creating the database connections on the fly as soon as I resolve the tenant database connection string from the request that has just hit the server.</p>
  <p>It's working as expected, but the connections keeps adding up and never they are never getting disconnected.
  From what I've been reading, it seems like the <em>mongoose.connect</em> manages the connections but the <em>mongoose.createConnection</em> doesn't, I'm not sure if my undestanding is correct here.</p>
  <p>I thought on creating my own connection pool with map in memory and use the connection from the map if it already exists in the map, but I'm not sure if this is a good approach.</p>
  <p>Does anyone know if there is a npm connection pool package already built for this issue? Or any implementation ideas?</p>
  <p>I also thought closing out each connection manually when the request lifecycle ends, but it will affect the performance if I have to connect and disconnect from mongo per each request, instead of using a connection pool.</p>
  <p>Here is the part of the code I'm creating the connection, nothing special here because I'm always creating the connection.</p>
  <pre><code>// ... Resolve connection string from request
  let tentantConn;
  try {
    // One connection per tenant
    tentantConn = await mongoose.createConnection(
      decrypt(tenant.dbUrl),
      {
        useNewUrlParser: true,
        useUnifiedTopology: true
      });
  }catch (e) {
    req.log.info({ message: `Unauthorized - Error connecting to tenant database: ${currentHostname}`, error: e.message });
    return reply.status(401).send({ message: `Unauthorized - Error connecting to tenant database: ${currentHostname}`, error: e.message });
  }
  // ...
  </code></pre>