How could I connect to a mongodb database from railway?
im searched online but its been a bit confusing based on what info railway gives me
47 Replies
Project ID:
4c05d88f-1ba0-4c53-b525-f736d53d0a33
4c05d88f-1ba0-4c53-b525-f736d53d0a33
may i ask whats confusing?
deploy mongo into your project, then setup reference variables on your desired service -
and then use the
MONGO_URL
environment variable in your code with whatever mongo client you likeim trying to connect through mongodb vs code but its just saying:
Unable to load connection: MongoServerSelectionError: connection <monitor> to 35.212.138.205:43765 closed
you are trying to connect to mongodb on railway locally?
yes
im trying to connect to the railway mongodb server locally through vs code
what does vscode have to do with this?
im not specifically saying vs code it does the same error through terminal
im jut trying to remove some entries in the database but i need to connect to it
what database client are you trying to use
im not using any
im jusgt using vscode extensions
that allow for database stuff
try with dbgate
on it
this didnt seem to work
i dont see an error?
im trying to get one here
click test
same error that we got before
what is the deployment status of the mongodb
its active
can you give me the host and port for the database?
roundhouse.proxy.rlwy.net
43765
https://utilities.up.railway.app/port-check?host=roundhouse.proxy.rlwy.net&port=43765
are you on school, work, public internet? you could be behind a firewall that blocks non common ports, 43765 is not a common port
nope im at home and arent using a firewall
is there a way i could test jsut connecting to the port regularly?
what os are you using?
macos
14.5
does that come with the
nc
command?yup
nc -zv roundhouse.proxy.rlwy.net 43765
it works
interesting
try redeploying the database
got it
i get the same connection error
can you connect to this with dbgate? -
mongodb://mongo:[email protected]:50629
yup i can
it works
screenshot of the tcp proxy for mongo please
this?
yeah, 27021 is wrong, remove the proxy and add it back with 27017, this will then change the url service variable so be sure to copy it again and try with dbgate
do i have to redeploy?
because i fixed it
dont think so
copy your new url and try with dbgate
same error
send me your mongo deloy logs please https://bookmarklets.up.railway.app/log-downloader/
have you tried to redeploy?
not yet i will now
it worked!
connecting is perfect
odd, but good!
well thank you so much
no problem!
next time you open a help thread for an error, please include that error in the post