B
B
BarneyGumble2017-10-30 13:05:57
MongoDB
BarneyGumble, 2017-10-30 13:05:57

How to properly connect to remote MongoDB?

Good afternoon
I'm trying to connect from a local computer to MongoDB located on a remote server, access to which I use via SSH I
connect as follows:

mongoose.connect('mongodb://root:[email protected]:22/database')

As a result I get an error:
MongoError: server 44.32.35.58:22 received an error {"err":"socketHandler","trace":"","parseState":{"sizeOfMessage":7597146
43}}

If I try to connect on a different port on which Mongo is running on this server, I get a different error:
Error: connect ECONNREFUSED 44.32.35.58:3306
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2017-10-30
@RidgeA

22 - this is the ssh port
of mongi, usually 27017
, you need to either configure the mongi ports outward, or make some kind of ssh tunnel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question