MongoDB connection error
When trying to connect to the database, it gives this error:
45 Replies
Project ID:
f8cc6b6a-813b-4d34-b2f8-20c87fba3048
f8cc6b6a-813b-4d34-b2f8-20c87fba3048
I was able to connect to the database via mongoDb Compass, but when trying to connect via
pymongo
- erroryou are using a url and specifying a port, please only use the url as the url would contain the port
I originally did it this way, just added a port later to check - maybe that will help
remove the port
alredy
okay let me know if you still get the same problem
The error remains
same?
are you using a railway database?
yep
yep
how are you setting the MONGO_URL locally?
.env
filehave you loaded that .env file? and if so, can you do a sanity check and print the MONGO_URL?
one min
please stop ping replying me
okay, sorry
print it right before the mongo client is what i meant
Btw, if you don't comment it out, you get this error
did it print though?
well now theres no errors?
the error is still present
can you connect to mongo from something like dbgate?
I don't use one of these, but I was able to connect via mongodb compass
is the mongoclient for python compatible with the mongo server railway is running?
How do you test it?
check the version railway uses and then check the docs for your python mongo client
I get a strange error when I try to run a separate class file for the database, maybe the reason is in it?
that would be a code issue
but please make sure mongoclient is compatible with the mongo server railway is running
pymongo==4.5.0
and for the version on the server, is it to look somewhere in the settings?looks like that uses mongo 7
So they're a match?
I can send you a link to connect to the database for the test if you need it
please check to make sure pymongo 4.5.0 is compatible with mongodb 7.0
what is that
is this an AI answer?
yep
please don't rely on that, go read the pymongo docs
perfect
this is just seeming like a code issue at this point
this issue wouldn't be isolated to the railway environment, please do research on this issue
I also tried connecting via code to my mongodb cluster created via mongo atlas and connected successfully
I'm sorry but code issues are a bit out of the scope of these help threads