Mac下mongodb connect failed 连接错误解决方法

时间:2022-04-27 02:36:03

查看elm 后台node 代码 一直连不上mongodb,报错

MongoDB shell version v3.6.0
connecting to: mongodb://127.0.0.1:27017
2017-12-27T09:54:34.775+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-27T09:54:34.778+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
解决办法

brew services start mongodb

然后连接成功