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

February 6, 2019 1.5k views
MongoDB Node.js Ubuntu 16.04

Hi, I followed this tutorial on how to connect to your remote MongoDB server [](http://)

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

1 Answer

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)


Have another answer? Share your knowledge.