title: MongoNetworkError: connection 3 to cluster0-shard-00-02-z0urk.mongodb.net:27017 closed
body: <blockquote>
    <p>{ MongoNetworkError: connection 3 to
    cluster0-shard-00-02-z0urk.mongodb.net:27017 closed
        at TLSSocket. (/home/fahad/Personal Work/Nodejs/Node js start/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:352:9)
        at Object.onceWrapper (events.js:276:13)
        at TLSSocket.emit (events.js:188:13)
        at _handle.close (net.js:610:12)
        at TCP.done (_tls_wrap.js:386:7)   name: 'MongoNetworkError',   errorLabels: [ 'TransientTransactionError' ],<br>
    [Symbol(mongoErrorContextSymbol)]: {} }</p>
  </blockquote>
  
  <pre><code>module.exports = (app, express , mongoose, path, bodyParser) =&gt; {
  
      app.use(express.static(path.resolve(__dirname, "../../dist")));
      app.use(bodyParser.json());
  
  
      mongoose.connect('mongodb+srv://fahad:123@cluster0-z0urk.mongodb.net/test?retryWrites=true', {useNewUrlParser: true})
      .then(()=&gt;console.log("DB server connect"))
      .catch(e =&gt; console.log("DB error", e));
  };
  </code></pre>