MongooseError:您不能在连接时多次"mongoose.connect()" [英] MongooseError: You can not `mongoose.connect()` multiple times while connected
问题描述
当我尝试使用Moongoose进行连接时出现以下错误.
I am getting the below error when trying to connect using moongoose.
MongooseError:连接时不能多次mongoose.connect()
.
MongooseError: You can not mongoose.connect()
multiple times while connected.
抛出新的_mongoose.Error('连接时不能多次mongoose.connect()
.');
^
MongooseError:连接时不能多次mongoose.connect()
.
在新的MongooseError(/node_modules/mongoose/lib/error/mongooseError.js:10:11)
throw new _mongoose.Error('You can not mongoose.connect()
multiple times while connected.');
^
MongooseError: You can not mongoose.connect()
multiple times while connected.
at new MongooseError (/node_modules/mongoose/lib/error/mongooseError.js:10:11)
请帮助我找到原因以及如何预防
Please help me find the cause for this and how to prevent it
推荐答案
在猫鼬版本5.6.1中,添加了检查 https://github.com/Automattic/mongoose/pull/7905
In mongoose version 5.6.1 the check was added https://github.com/Automattic/mongoose/pull/7905
恢复为较早版本以进行快速修复.
Revert to an older version for a quick fix.
这篇关于MongooseError:您不能在连接时多次"mongoose.connect()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!