title: MongoParseError: URI does not have hostname, domain name and tld
body: <p>I'm getting this error when I try to connect my app(nodejs) to mongodb. I really appreciate your help here.</p>
  
  <pre><code>MongoParseError: URI does not have hostname, domain name and tld
      at parseSrvConnectionString (E:\Projects\NodeAPI\node_modules\mongodb-core\lib\uri_parser.js:41:21)
      at parseConnectionString (E:\Projects\NodeAPI\node_modules\mongodb-core\lib\uri_parser.js:509:12)
      at connect (E:\Projects\NodeAPI\node_modules\mongodb\lib\operations\mongo_client_ops.js:195:3)
      at connectOp (E:\Projects\NodeAPI\node_modules\mongodb\lib\operations\mongo_client_ops.js:284:3)
      at executeOperation (E:\Projects\NodeAPI\node_modules\mongodb\lib\utils.js:416:24)
      at MongoClient.connect (E:\Projects\NodeAPI\node_modules\mongodb\lib\mongo_client.js:175:10)
      at Function.MongoClient.connect (E:\Projects\NodeAPI\node_modules\mongodb\lib\mongo_client.js:341:22)
      at Object.&lt;anonymous&gt; (E:\Projects\NodeAPI\server.js:12:13)
      at Module._compile (internal/modules/cjs/loader.js:816:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    name: 'MongoParseError',
    [Symbol(mongoErrorContextSymbol)]: {} }
  </code></pre>
  
  <p>My code:</p>
  
  <p>db.js</p>
  
  <pre><code> module.exports = {
  uri : "mongodb+srv://mithun:*******@cluster0-s089x.mongodb.net/test?retryWrites=true"}
  </code></pre>
  
  <p>==================================================================</p>
  
  <p>node_route.js</p>
  
  <pre><code> module.exports = function(app, db){
  app.post('/notes', (req, res) =&gt; {
      const note = {text: req.body.body, title: req.body.title};
      db.collection('notes').insert(note, (err, results) =&gt; {
          if(err){
              res.send({'error': 'An error has occured'});
          } else {
              res.send(result.ops[0]);
          }
      });
   });
   };
  </code></pre>
  
  <p>=======================================================================
  index.js</p>
  
  <pre><code> const noteRoutes = require('./note_route');
   module.exports = function(app, db){
   noteRoutes(app, db);
  }
  </code></pre>
  
  <p>=========================================================================
  server.js</p>
  
  <pre><code>       const express = require('express');
  const MongoClient = require('mongodb').MongoClient;
  const bodyParser = require('body-parser');
  const db = require('./config/db');
  const app = express();
  const port = 8000;
   app.use(bodyParser.urlencoded({extended: true}));
    MongoClient.connect(db.uri,{ useNewUrlParser: true }, (err, database) =&gt; 
    {
       if (err) return console.log(err);
       require('./app/routes')(app, database);
        app.listen(port, () =&gt; {
             console.log("We are live on " +port);
    });
   });
  </code></pre>
  
  <p>===========================================================================</p>
  
  <pre><code>module.exports = {
  uri : "mongodb+srv://mithun:m3Thun#47@cluster0-s089x.mongodb.net/test?retryWrites=true&amp;ssl=false"
  </code></pre>
  
  <p>}</p>
  
  <p>I've tried with ssl= false but the error remains same. </p>