Abhishek Sharma
Abhishek Sharma

Reputation: 11

MongoDB Error: connect EINVAL 0.0.0.123:27017 - Local (0.0.0.0:0)

Whenever I am trying to run the server this error comes, quite search a little bit but not able to find the solution.

Server is running fine

MongoDB Error:  { Error: connect EINVAL 0.0.0.123:27017 - Local
(0.0.0.0:0) at Object._errnoException (util.js:992:11) at 
_exceptionWithHostPort (util.js:1014:20) at internalConnect (net.js:960:16) at defaultTriggerAsyncIdScope
(internal/async_hooks.js:284:19) at GetAddrInfoReqWrap.emitLookup [as
callback] (net.js:1106:9) at GetAddrInfoReqWrap.onlookup [as
oncomplete] (dns.js:97:10) name: 'MongoError', message: 'connect
EINVAL 0.0.0.123:27017 - Local (0.0.0.0:0)' }

Here the error if you need it

how to get rid of this, thanks in advance!

Upvotes: 1

Views: 1502

Answers (1)

Dana Asbury
Dana Asbury

Reputation: 215

This error tends to show up when you aren't prefixing your connection string with the correct protocol, mongodb.

From the documentation:

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

mongo connection string documentation

So if you are connecting to local host:

mongodb://localhost:27017

Upvotes: 3

Related Questions