The error I am receiving:
{ [MongoNetworkError: failed to connect to server [127.0.0.1:37017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:37017]] name: 'MongoNetworkError', [Symbol(mongoErrorContextSymbol)]: {} }
*I had set the port while setting up my local database as 37017.
A mongo client in a separate terminal window is able to connect to the local server and execute commands. The problem occurs when I try to connect to the same server using a NodeJs application. I am attempting to run this simple code:
What I have tried:
1.Reinstalling mongodb and restarting server
2.Using localhost instead of 127.0.0.1
Edit: ps confirms a mongod daemon is running
I am fairly new to nodeJs and MongoDB so debugging this error this early on has become a major headache! I am on a Mac running OS Catalina if that is related. Thank you!