Chat
Chat copied to clipboard
MongooseError: Can't call `openUri()` on an active connection with different connection strings.
I get this error when trying to start the server.
MongooseError: Can't call openUri() on an active connection with different connection strings. Make sure you aren't calling mongoose.connect() multiple times. See: https://mongoosejs.com/docs/connections.html#multiple_connections
at NativeConnection.Connection.openUri (C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\connection.js:693:13)
at C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\index.js:345:10
at C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
at new Promise (
Try commenting out line 19 in the model/model.js file which says,
mongoose.connect('mongodb://localhost/mongodb')
Since line 5 already established a connection, I am not sure why the duplicate is needed.
This worked for me.