Question

Connecting mongodb instance on server to Compass

I have a droplet server with an instance of mongodb on it. I can connect via SSH and view mongodb, however I really want to connect it to compass. However I keep getting ‘connect ECONNREFUSED’ error.

I’ve tried combinations of using localhost, my ip, different ports (as per what I’ve found via ssh) but still same error. If I try my ip:3000 interestingly it does attempt to connect but then I get an ‘invalid max size’ error or something like that.

I checked another ticket and also tried accessing in Compass using SSH tunnel but same ECONNREFUSED. What else can I check to get this fixed?

Thanks,


Submit an answer
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
June 8, 2022

Hi there,

In order to connect remotely to your MongoDB instance, you need to configure it to allow remote connections as described in this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-configure-remote-access-for-mongodb-on-ubuntu-20-04

For anyone using a Managed MongoDB cluster, you can follow the steps here instead:

https://dev.to/digitalocean/how-to-easily-connect-to-digitaloceans-managed-mongodb-5gd1

Best,

Bobby