title: Too many mongod processes
body: <p>We have test server with 3 different node.js apps running on it. Each application is using the same MongoDB database test instance of which also runs on the same server. So at any given moment of time we have at most 3 different open connections to mongodb server.</p>
  
  <p>The issue is that after each code deployment (which basically is: killing currently running process, code update and starting new process) i see new process(thread of a single proccess) on server which is shown in htop as <code>/usr/bin/mongod --config /etc/mongodb.conf</code>. Thus once in awhile we have to restart the test server because there are too many not used threads like that and it makes the mongod process take all the RAM.</p>
  
  <p>I am not sure why is this happening and looking for solution to fix this issue.</p>
  
  <p>My assumption is that if we simply kill the node.js proccess the connection (and therefore the thread related to this connection) somehow stays alive and therefore instead of killing nodejs process, we should gracefully shut it down with closing the DB connection.</p>