title: Cannot connect to remote mongodb server
body: <p>I changed bindIp setting to</p>
  
  <blockquote>
    <p>bindIp: 127.0.0.1, 0.0.0.0</p>
  </blockquote>
  
  <p>in mongod.conf on my ubuntu server hosted on Linode and restarted mongod and status looks ok.</p>
  
  <p>I opened mongodb port on ufw </p>
  
  <p>sudo ufw status
  Status: active</p>
  
  <blockquote>
    <p>To                         Action      From
    --                         ------      ---- 22/tcp                     ALLOW       Anywhere                   10000<br>
    ALLOW       Anywhere                   Nginx Full<br>
    ALLOW       Anywhere                   3333<br>
    ALLOW       Anywhere                   27017<br>
    ALLOW       Anywhere                   22/tcp (v6)<br>
    ALLOW       Anywhere (v6)              10000 (v6)<br>
    ALLOW       Anywhere (v6)              Nginx Full (v6)<br>
    ALLOW       Anywhere (v6)              3333 (v6)<br>
    ALLOW       Anywhere (v6)              27017 (v6)<br>
    ALLOW       Anywhere (v6)</p>
  </blockquote>
  
  <p>Connecting to it from my mac throws error:</p>
  
  <blockquote>
    <p>mongo mongodb://admin:secret@ubuntuipaddress/fielddb?authSource=admin
    MongoDB shell version v3.6.2 connecting to:
    mongodb://ubuntuipaddress/fielddb?authSource=admin
    2018-04-08T13:47:32.212 W NETWORK  [thread1] Failed to connect to
    ubuntuipaddress:27017, in(checking socket for error after poll),
    reason: Connection refused 2018-04-08T13:47:32.214 E QUERY<br>
    [thread1] Error: couldn't connect to server ubuntuipaddress:27017,
    connection attempt failed : connect@src/mongo/shell/mongo.js:251:13
    @(connect):1:6 exception: connect failed</p>
  </blockquote>
  
  <p>How to fix this issue?</p>