'Connection to monitor closed MongoDB
I am trying to run my discord bot but I get this error
[12/4/2021, 2:06:02 AM] - [INFO] - [ShardManager] Started 1 shards
[12/4/2021, 2:06:28 AM] - [ERROR] - connection <monitor> to IP closed
MongoServerSelectionError: connection <monitor> to IP closed
at Timeout._onTimeout (d:\Default Download\LenoxBot-master\LenoxBot-master\node_modules\mongodb\lib\core\sdam\topology.js:438:30)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
reason: TopologyDescription {
type: 'Single',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map(1) {
'mydblink' => [ServerDescription]
},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: null
}
}
I have replaced all sensitive information with placeholders. How do I fix this error?
Solution 1:[1]
I solved this issue by doing this:
- Go to mongodb. In the left you will see a security tab. Under this tab click on "Network Access".
- Then click add ip address.
- There you'll see a button saying "Add current ip address".Click that
- you have to modify your ip address a little (the main part!). At the end of your ip address add "/0". Like, x.x.x.x/0.
- Then press confirm. That's it! Hope it will help you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nahid Khan |