I am facing an issue with the mongodb 4.0. I have setup mongodb on remote server and want to connect it with robo3t. But getting the below error.

enter image description here

And here is my mongodb.conf file

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
  dbPath: /var/lib/mongodb
    enabled: true

#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
  port: 27017

# how the process runs
  timeZoneInfo: /usr/share/zoneinfo

 #authorization: "enabled"




## Enterprise-Only Options:



Mongodb version --> 4.0 Os --> ubuntu 16.04


enter image description here

  • How are you starting your MongoDB server (i.e. using a service definition or passing parameters manually)? You can use db.serverCmdLineOpts() in the mongo shell to check that your options are being correctly parsed. Assuming there are no errors starting MongoDB with your example config, mongod should be listening to all network interfaces and any basic remote access issues are likely related to your O/S or hosting firewalls (i.e. AWS Security Groups). I'd strongly recommend enabling auth, access control, and TLS/SSL to secure your deployment before opening it up on a public network. – Stennie Mar 30 at 23:09
  • Please review the MongoDB Security Checklist for more information including links to tutorials. I also recommend testing your config with the matching 4.0 mongo shell before trying third party tools. Robo3T isn't actively updated and embeds a specific version of the mongo shell (the current 1.2 release is based on the mongo 3.4.3 shell). For best outcomes I would recommend using an actively updated tool that explicitly mentions support for your MongoDB server version. – Stennie Mar 30 at 23:10

First, make sure the MongoDB service is running in the remote machine.

Next, check if the MongoDB port is open to the outside network or not.

The following will help you check if the 27017 is accessible from an outside machine.

nmap -Pn

If the port is not enabled, use the following command to expose the port.

sudo iptables -I INPUT -p tcp -s --dport 27017 -j ACCEPT
  • Thank you for the answer. But it didn't work. – Fanpark Apr 1 at 5:40
  • Are you able to connect using mongo shell? Also, can you post the error message you get when connect using robo mongo by clicking on show error details. – Mani Apr 1 at 5:49
  • Yes I am able to connect using mongoshell. Even my code nodejs code is properly working over there. Only problem is I am not able to connect using robo31 or compass as well. Please check the updated question for the error details – Fanpark Apr 1 at 5:51
  • Please refer this link question also stackoverflow.com/a/54521387/3432487 – Mani Apr 1 at 6:03
  • 1
    It was nowhere mentioned that the MongoDB is hosted in an AWS EC2 instance, so was not able to give you the exact answer. – Mani Apr 9 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.