MongoDB connection refused

I would download the Mongo Shell (mongosh) and try to run the following command to eliminate the nodejs code. This way we can work around some possible issues. (https://www.mongodb.com/docs/mongodb-shell/install/)

mongosh mongodb://127.0.0.1:27017

Another test could be to use MongoDB Compass and connect to 127.0.0.1.

Please post any errors you get when doing these tests