【发布时间】:2022-07-05 01:53:58
【问题描述】:
我正在学习 MongoDB,很抱歉打扰你,但我收到了这个错误:
MongoServerSelectionError: connection <monitor> to xx.xxx.xxx.xxx:27017 closed
at Timeout._onTimeout (C:\...\node_modules\mongodb\lib\sdam\topology.js:305:38)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-c9obg9r-shard-00-00.onq7cwz.mongodb.net:27017' => [ServerDescription],
'ac-c9obg9r-shard-00-02.onq7cwz.mongodb.net:27017' => [ServerDescription],
'ac-c9obg9r-shard-00-01.onq7cwz.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-up12ch-shard-0',
logicalSessionTimeoutMinutes: undefined
},
code: undefined,
[Symbol(errorLabels)]: Set(0) {}
}
我尝试启用端口 27017 并在网络访问选项卡中重置 ip(已经被列入白名单),但没有运气,错误仍然存在。重新安装了我使用的模块,什么也没有。 我的代码昨天还在工作,但是在 Windows 更新后我无法连接(这就是我认为它是端口的原因)。 我替换的 xx.xxx.xxx.xxx:27017 的数字不是我的 ip 号码,我不知道这是否有帮助。
如果你有任何想法,我很感激你的意见。
【问题讨论】:
标签: database mongodb connection database-connection