I am getting the below error when trying to connect using moongoose.
MongooseError: You can not mongoose.connect()
multiple times while connected.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With