title: MongoNetworkError: connect ETIMEDOUT
body: <p>SOMETIMES when our team connect the mongodb database at localhost by these codes:</p>
  
  <pre><code>const mongoose = require('mongoose');
  const CONN = 'mongodb://name:password@www.wecard.io:27017/myproject'
  
  const option = {
      socketTimeoutMS: 30000,
      keepAlive: true,
      reconnectTries: 30000
  };
  
  mongoose.connect(CONN, option).then(
    () =&gt; { console.log('It is good: ' + CONN); },
    (err) =&gt; {
      console.error('Error: ' + err);
      console.log(err);
    }
  );
  </code></pre>
  
  <p>ONE of our teammates get this error:</p>
  
  <pre><code>MongoNetworkError: failed to connect to server [www.website.com:27017] on first connect [MongoNetworkError: connect ETIMEDOUT 46.101.98.56:27017]
      at Pool.&lt;anonymous&gt; (/Users/liubaobao/Desktop/WeCard/models/node_modules/mongodb-core/lib/topologies/server.js:505:11)
      at emitOne (events.js:116:13)
      at Pool.emit (events.js:211:7)
      at Connection.&lt;anonymous&gt; (/Users/liubaobao/Desktop/WeCard/models/node_modules/mongodb-core/lib/connection/pool.js:329:12)
      at Object.onceWrapper (events.js:317:30)
      at emitTwo (events.js:126:13)
      at Connection.emit (events.js:214:7)
      at Socket.&lt;anonymous&gt; (/Users/liubaobao/Desktop/WeCard/models/node_modules/mongodb-core/lib/connection/connection.js:245:50)
      at Object.onceWrapper (events.js:315:30)
      at emitOne (events.js:116:13)
      at Socket.emit (events.js:211:7)
      at emitErrorNT (internal/streams/destroy.js:64:8)
      at _combinedTickCallback (internal/process/next_tick.js:138:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)
    name: 'MongoNetworkError',
    message: 'failed to connect to server [www.website.com:27017] on first connect [MongoNetworkError: connect ETIMEDOUT 46.101.98.56:27017]'
  </code></pre>
  
  <p>And at the same time if we connect it on cloud server, it has been always good so far. So anyone knows how to fix it? Thanks.</p>