db object already connecting, open cannot be called multiple times
发布于 8个月前 作者 smileyang 880 次浏览

使用的版本 { "name": "microblog", "version": "0.0.1", "private": true, "scripts": { "start": “node ./bin/www” }, "dependencies": { "express": "~4.2.0", "static-favicon": "~1.0.0", "morgan": "~1.0.0", "cookie-parser": "~1.0.1", "body-parser": "~1.0.0", "debug": "~0.7.4", "ejs": "~0.8.5", “connect-mongo” : ">=0.1.7", "mongodb": "", "connect-flash": "" } } db object already connecting, open cannot be called multiple times undefined

Error: db object already connecting, open cannot be called multiple times at Db.open (D:\node\microblog\node_modules\mongodb\lib\mongodb\db.js:257:11) at User.save (D:\node\microblog\models\user.js:18:10) at Object.module.exports [as handle] (D:\node\microblog\routes\index.js:51:10) at next_layer (D:\node\microblog\node_modules\express\lib\router\route.js:103:13) at Route.dispatch (D:\node\microblog\node_modules\express\lib\router\route.js:107:5) at D:\node\microblog\node_modules\express\lib\router\index.js:205:24 at Function.proto.process_params (D:\node\microblog\node_modules\express\lib\router\index.js:269:12) at next (D:\node\microblog\node_modules\express\lib\router\index.js:199:19) at next_layer (D:\node\microblog\node_modules\express\lib\router\route.js:77:14) at next_layer (D:\node\microblog\node_modules\express\lib\router\route.js:81:14)

2 回复

你一定是在某个require的module中再次调用了db.open了,记得先调用db.close()

谢谢,问题解决了,函数嵌套的逻辑错了,

回到顶部