New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mongoose not reconnecting after disconnection event #14517
Labels
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
Comments
IslandRhythms
added
the
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
label
May 1, 2024
const mongoose = require('mongoose');
async function run() {
await mongoose.connect('mongodb://localhost:27017');
}
mongoose.connection.on('close', async () => {
console.log('lost connection');
});
mongoose.connection.on('reconnect', () => console.log('reconnect'));
mongoose.connection.on('reconnected', () => console.log('reconnected'))
mongoose.connection.on('connected', () => console.log('connected'));
mongoose.connection.on('disconnected', () => console.log('disconnected'))
mongoose.connection.on('disconnecting', () => console.log('disconnecting'))
run(); |
@IslandRhythms - Did you use the same version I mentioned? I tried and the issue is still reproduced with your simple test: |
IslandRhythms
added
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
and removed
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
labels
May 6, 2024
I'm similarly unable to repro with a local MongoDB instance. @elizatlawy it looks like you might be connecting to MongoDB Atlas, if so how are you restarting MongoDB? |
The issue was with our port-forward and not with Mongo, my apologies. I'm closing this one. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
Prerequisites
Mongoose version
6.10.1
Node.js version
14.18.3
MongoDB server version
5.0.9
Typescript version (if applicable)
No response
Description
My connection looks like this:
If I restart my Mongodb I get the
disconnected
event but there is no reconnect attempt, I am able to reconnect only after restarting theNode.js
server.Steps to Reproduce
Expected Behavior
Mongoose should try to reconnect.
The text was updated successfully, but these errors were encountered: