title: Node/express application failing to connect to Mongodb Atlas using mongoose
body: <p>I have a node/express application that I am trying to connect to Mongodb Atlas using mongoose.</p>
  
  <p>All of my code is identical to a previous app that I had connect to Atlas (which worked fine). When I run it on my work machine (Windows 10) everything works as expected. However, when I run it on my MacBook Pro (Mojave), the express app runs but the mongoose connection to Atlas throws the following error:</p>
  
  <pre><code>{ Error: queryTxt EBADNAME development-zv5hp.mongodb.net
      at QueryReqWrap.onresolve [as oncomplete] (dns.js:196:19)
    errno: 'EBADNAME',
    code: 'EBADNAME',
    syscall: 'queryTxt',
    hostname: 'development-zv5hp.mongodb.net' }
  </code></pre>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>const express = require('express');
  const mongoose = require('mongoose');
  
  const app = express();
  
  mongoose
    .connect(
      'mongodb+srv://client:&lt;PASSWORD&gt;@development-zv5hp.mongodb.net/shop',
      { useNewUrlParser: true }
    )
    .then(() =&gt; console.log('MongoDB Connected...'))
    .catch(err =&gt; console.log(err));
  
  const PORT = process.env.PORT || 5000;
  app.listen(PORT, () =&gt; console.log(`Server running on port ${PORT}`));
  </code></pre>
  
  <p>What might be causing this issue?
  I have checked the Atlas user and password and have whitelisted my IP (in fact whitelisted all IPs)</p>
  
  <p>Using:</p>
  
  <ul>
  <li>node v10.15.3</li>
  <li>express v4.16.4</li>
  <li>mongoose v5.5.1</li>
  </ul>