Skip to content

No disconnected event when MongoDB docker container closed v5.7.3 #8212

@shaneguayCanopy

Description

@shaneguayCanopy

This is an interesting issue in that the 'disconnected' event is never triggered when the MongoDB is brought down. We are running MongoDB through a Docker container and running a local node.js file.

We are using the latest Mongoose version 5.7.3.

When we tried an older version 5.0.12 it works. We found a similar issue that was described as being fixed in 5.0.12 from this ticket ("error event not triggered #6131") and indeed in 5.0.12 we did properly receive the 'disconnected' event when we closed the MongoDB container.

So it seems this bug has regressed and is back in latest version

mongoose.connection.on('disconnected', () => { console.log('DISCONNECTED!'); });

Metadata

Metadata

Assignees

No one assigned

    Labels

    helpThis issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions