【问题标题】:MongoError: topology was destroyed, how can i fix it? [duplicate]MongoError:拓扑被破坏,我该如何修复它? [复制]
【发布时间】:2019-01-15 11:41:54
【问题描述】:

我正在使用 mongo 服务器和 node.js

当我第二次尝试使用我的函数按名称查找客户端时,我得到了“拓扑被破坏”的错误

function findClient(Fname,res){
    let query = {name:Fname}
    dbo.collection("clients").find(query).toArray(function(err, result) {
        if (err) throw err;
        console.log(result.name);
        res.send(result)
        db.close();
    });
}

【问题讨论】:

  • 重启可能会解决您的问题
  • 根据我的经验,节点进程/服务器在查询有时间返回之前就终止了..

标签: node.js mongodb mongoose server topology


【解决方案1】:

确保您的防火墙没有阻止您的请求,如果您在公司的本地网络中,可能与您的 VPN/代理有关。

Similar issue where the problem was related to Firewall

您可能还需要确保 db.close() 的使用和位置

Same issue where the problem was an 'errant close() call' causing the issue

【讨论】:

    猜你喜欢
    • 2015-09-03
    • 2015-07-09
    • 2020-10-23
    • 2016-12-27
    • 2021-04-30
    • 2019-11-14
    • 2015-08-06
    相关资源
    最近更新 更多