You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from within my JUnit5/Kotlin framework. I immediately test this using KMongo, and it seems to work fine using the mongoDbReplicaSet.getReplicaSetUrl() string. For example, something like mongodb://localhost:55051/test&readPreference=primary
Then I start my Node.js service via Java's ProcessBuilder and the service seems to run okay. I can send it HTTP requests from my JUnit 5 code, and it responds. However, when I try to connect to MongoDB using the same URI, the Mongo Node driver responds with
I don't understand why the message is complaining about connect ECONNREFUSED 127.0.0.1:27017 since the URI specifies port 55051. I don't know if the message is from the driver or the server?
When I start MongoDB manually in Docker from our scripts, my Node.js service is able to interact fine with MongoDB.
to force to use a hostname (requires adding host.docker.internal or dockerhost to the OS host file. See Supported features or an article for details) ? MongoDbReplicaSet#getReplicaSetUrl() will return something like mongodb://dockerhost:55220,dockerhost:55221/test?replicaSet=docker-rs&readPreference=primary in this case
I am starting up Mongo via
from within my JUnit5/Kotlin framework. I immediately test this using KMongo, and it seems to work fine using the
mongoDbReplicaSet.getReplicaSetUrl()
string. For example, something likemongodb://localhost:55051/test&readPreference=primary
Then I start my Node.js service via Java's
ProcessBuilder
and the service seems to run okay. I can send it HTTP requests from my JUnit 5 code, and it responds. However, when I try to connect to MongoDB using the same URI, the Mongo Node driver responds withI don't understand why the message is complaining about
connect ECONNREFUSED 127.0.0.1:27017
since the URI specifies port55051
. I don't know if the message is from the driver or the server?When I start MongoDB manually in Docker from our scripts, my Node.js service is able to interact fine with MongoDB.
I also tried using https://www.testcontainers.org/modules/databases/mongodb/ but then the error I get is
This seems to be a problem with white-listing, where MongoDB does not like the IP Address my Node.js service is calling from. https://stackoverflow.com/questions/65277035/mongoserverselectionerror-connection-timed-out-with-nodejs-and-express
Any insight on what the problems may be here would be greatly appreciated.
The text was updated successfully, but these errors were encountered: