How do I connect to my droplets database (mongodb) from MongoDB Compass

Hi, I followed this tutorial on how to connect to your remote MongoDB server

I have been able to connect with the remote ip on my droplet, but not on mongodb compass.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Here’s how I made it work:

  1. In the “Connect to host” page, leave the first section as is (localhost, 28017…) as we will be connecting from “inside” the droplev (via the SSH Tunnel). Only change the port if you also changed it in your DO Mongo.

  2. Leave Authenthentication, Read Preference and SSL as they are, unless you have changed some of them inside your droplet. I believe these apply to the authentication of the databases, not your droplet.

  3. Set up the SSH Tunnel with either: 3a. Use Password (that’s what I did): Use your droplet’s IP as the hostname, port 22, and your command line username and password, or 3b. Use an identity File (I’m assuming this is like the key file setup you might use in Putty)