I’m attempting to set up a database server for an app using Node.js. I installed mongoDB as a windows service and I’ve successfully connected to the database server using MongoDB Compass.
When attempting to connect to the service from my localhost either via my Node.js app or just attempting to ping it via ‘telnet 127.0.0.1 27017’ I get a refused connection error.
I’ve verified that the MongoDB server is spinning up by looking at the startup logs in MongoDB Compass. It is successfully registering all changes to config files etc. and I can visualize it listening on the specified port/IP address. I have also turned off my windows firewall in addition to creating a rule to bypass it when it was on.
I have tried several iterations in the mongod.cfg recommended in most forum posts etc… and none of them seem to be working. I.e.
bindIp=0.0.0.0 or bindIp=127.0.0.1. My current configuration is
network interfaces
net:
port: 27017
bindIp: 127.0.0.1
setParameter:
enableLocalhostAuthBypass: true
Edit: Should clarify that I see nothing output in the logs for MongoDB whenever I fail to ping/connect via my Node.js app. I do see a significant amount being logged when I connect via MongoDB Compass. I have also attempted to send a post to the server via PostMan and these are the results.
http://localhost:27017
body: { “Status” : “Posting” }
*from the logs
{“t”:{“$date”:“2024-03-24T09:46:52.012-04:00”},“s”:“I”, “c”:“NETWORK”, “id”:22943, “ctx”:“listener”,“msg”:“Connection accepted”,“attr”:{“remote”:“127.0.0.1:63524”,“uuid”:{“uuid”:{“$uuid”:“519c73da-9f1c-490b-8b82-9fdcb0412a7e”}},“connectionId”:21,“connectionCount”:14}}
{“t”:{“$date”:“2024-03-24T09:46:52.012-04:00”},“s”:“I”, “c”:“EXECUTOR”, “id”:22988, “ctx”:“conn21”,“msg”:“Error receiving request from client. Ending connection from remote”,“attr”:{“error”:{“code”:141,“codeName”:“SSLHandshakeFailed”,“errmsg”:“SSL handshake received but server is started without SSL support”},“remote”:“127.0.0.1:63524”,“connectionId”:21}}
{“t”:{“$date”:“2024-03-24T09:46:52.012-04:00”},“s”:“I”, “c”:“NETWORK”, “id”:22944, “ctx”:“conn21”,“msg”:“Connection ended”,“attr”:{“remote”:“127.0.0.1:63524”,“uuid”:{“uuid”:{“$uuid”:“519c73da-9f1c-490b-8b82-9fdcb0412a7e”}},“connectionId”:21,“connectionCount”:13}}
Any help would be much appreciated as I feel I’ve exhausted all of my options as far as research goes. Thanks in advance.
