title: Number of active connections on the server reached to max
body: <p>I am working with mongodb and nodejs. I have mongodb hosted on Atlas. </p>
  
  <p>My backend had been working perfectly but now it is sometimes getting stuck and when I see the analytics on mongodb atlas it shows maximum number of active connections reached to <strong>100</strong>.</p>
  
  <p><a href="https://i.stack.imgur.com/hWEUk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hWEUk.png" alt="enter image description here"></a></p>
  
  <p>Can someone please explain why this is happening? Can I reboot the connections and make it <strong>0</strong>?</p>
  
  <p><strong>@Stennie</strong> I have used mongoose to connect to database</p>
  
  <p>Here is my configuration file</p>
  
  <pre><code>const mongooseOptions = {
    useNewUrlParser: true,
    autoReconnect: true,
    poolSize: 25,
    connectTimeoutMS: 30000,
    socketTimeoutMS: 30000
  } 
  
  exports.register = (server, options, next) =&gt; {
    defaults = Hoek.applyToDefaults(defaults, options)
  
    if (Mongoose.connection.readyState) {
      return next()
    }
  
    if (!Mongoose.connection.readyState) {
      server.log(`${process.env.NOED_ENV} server connecting to ${defaults.url} ${defaults.url}`)
  
      return Mongoose.connect(defaults.url, mongooseOptions).then(() =&gt; {
        return next() // call the next item in hapi bootstrap
      })
    }
  }
  </code></pre>