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

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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)