title: Configure Mongo using mongodb+srv
body: <p>I start mongo on docker, so default host: <code>localhost</code>, port: <code>27017</code>, username: <code>root</code>
  password: <code>example</code> </p>
  
  <p>Now i want to connect via connection string:
  <code>mongodb+srv://root:example@localhost/sim</code>
  But i get an error saying:</p>
  
  <blockquote>
    <p>Caused by: com.mongodb.MongoConfigurationException: Unable to look up
    TXT record for host localhost</p>
  </blockquote>
  
  <p>In my hosts file i have:</p>
  
  <pre><code>127.0.0.1       localhost
  127.0.0.1 _mongodb._tcp.localhost
  </code></pre>
  
  <p>Mongo is running on docker:</p>
  
  <pre><code>Docker ps
   mongo                     "docker-entrypoint.s…"   13 days ago         Up 3 hours          0.0.0.0:27017-&gt;27017/tcp     
  </code></pre>
  
  <p>Ubuntu 18.04</p>