Mongod not functioning correctly

时间:2015-10-06 08:45:01

标签: javascript node.js mongodb mongoose

I keep getting this response when trying to run a node app with a MongoDB

body-parser deprecated bodyParser: use individual json/urlencoded middlewares server.js:32:9
body-parser deprecated undefined extended: provide extended option node_modules/body-parser/index.js:105:29
express-session deprecated undefined resave option; provide resave option server.js:35:9
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option server.js:35:9
Running on3000

/Users/tvc/Desktop/SupperClubApp/node_modules/mongoose/node_modules/mongodb/lib/server.js:228
        process.nextTick(function() { throw err; })
                                            ^`

Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)

I am unsure as to how to resolve it. Any tips much appreciated.

1 个答案:

答案 0 :(得分:2)

Analysis: the issue as per the exception that you copied in the comments says that you Mongodb connection could not be established as there was an issue with Mongodb connection close the previous time. Mongodb will encounter this issue when your computer was forceshutdown due to power outages and other issues. the exception content from your comments is as below: [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty. 2015-10-06T09:50:54.164+0100 D - [initandlisten] User Assertion: 98:Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running? Investigation: Check if there is a file named Mongod.lock got created in your \bin folder. Solution: If the size of the file Mongod.lock is greater than 0KB, please delete the file and re run your mongodb. It should work fine. More details at this link