title: Mongoose MongoError: topology was destroyed
body: <p>i am running in a MongoError "Topology was destroyed" from time to time. My Application uses nodejs, mongodb, mongoose (4.1.3), express (4.13.3).</p>
  
  <p>To connect to the server i am using the following params:</p>
  
  <pre><code>var con = mongoose.createConnection(baseUri, { 
      server: { 
          poolSize: 1 
      }, socketOptions: { 
          keepAlive: 1, 
          connectTimeoutMS: 10000 
      }});
  </code></pre>
  
  <p>That's what i find in the log files:</p>
  
  <pre><code>/data/var/www/rk/node_modules/mongoose/node_modules/mongodb/lib/server.js:235
          process.nextTick(function() { throw err; })
                                        ^
  MongoError: server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}
      at null.&lt;anonymous&gt; (/data/var/www/rk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:265:47)
      at g (events.js:260:16)
      at emitTwo (events.js:87:13)
      at emit (events.js:172:7)
      at null.&lt;anonymous&gt; (/data/var/www/rk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:77:12)
      at g (events.js:260:16)
      at emitTwo (events.js:87:13)
      at emit (events.js:172:7)
      at Socket.&lt;anonymous&gt; (/data/var/www/rk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:121:49)
      at Socket.g (events.js:260:16)
      at emitOne (events.js:77:13)
      at Socket.emit (events.js:169:7)
      at emitErrorNT (net.js:1253:8)
      at doNTCallback2 (node.js:441:9)
      at process._tickCallback (node.js:355:17)
  </code></pre>
  
  <p>Could anyone tell me what this Error means and how i can solve it ?</p>
  
  <p>THANKS!!!</p>
  
  <p>BR,
  Martin</p>