【问题标题】:How to solve MongoError: pool destroyed while connecting to CosmosDB如何解决 MongoError:连接到 CosmosDB 时池被破坏
【发布时间】:2017-08-12 04:29:22
【问题描述】:

我有 Node.js 服务,我在其中使用 mongo-API 与 Document/Cosmos DB 进行通信。 我的服务运行良好并执行了所有的 crud 操作,但 1 分钟后从服务中抛出了一些 mongo 错误。

/document-db-service/node_modules/mongodb/lib/utils.js:123
    process.nextTick(function() { throw err; });
                                  ^
MongoError: pool destroyed
    at Pool.write (/document-db-service/node_modules/mongodb-core/lib/connection/pool.js:922:12)
    at Cursor._find (/document-db-service/node_modules/mongodb-core/lib/cursor.js:286:22)
    at nextFunction (/document-db-service/node_modules/mongodb-core/lib/cursor.js:584:10)
    at Cursor.next [as _next] (/document-db-service/node_modules/mongodb-core/lib/cursor.js:692:3)
    at fetchDocs (/document-db-service/node_modules/mongodb/lib/cursor.js:856:10)
    at toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:883:3)
    at Cursor.toArray (/document-db-service/node_modules/mongodb/lib/cursor.js:836:44)
    at exports.getDocsOfCollections (/document-db-service/services/collections.js:273:10)
    at Layer.handle [as handle_request] (/document-db-service/node_modules/express/lib/router/layer.js:95:5)
    at next (/document-db-service/node_modules/express/lib/router/route.js:137:13)

我无法理解为什么会出现此错误。请提出解决此错误所需进行的更改。

【问题讨论】:

  • 哇.. 自昨晚以来,我也遇到了同样的错误。在出现该错误之前,我看到连接工作了约 10 秒。
  • 你如何解决这个问题??
  • 否则我不会回答你的。
  • 我遇到了同样的问题,尽管我今天正在制作一个新原型,所以这对我来说并不代表回归。我可以通过从连接字符串中删除replicaSet=globaldb 来避免这个问题,但我怀疑这可能不是一件 的事情。
  • 此问题已被 Microsoft (feedback.azure.com/forums/599059-azure-cosmos-db-mongodb-api/…) 识别,但截至 2017 年 6 月 27 日,他们尚未更新任何详细信息。

标签: node.js mongodb npm azure-cosmosdb


【解决方案1】:

我也遇到了同样的问题,去掉了连接字符串mongodb中的replica set参数: ........./?ssl=true**&replicaSet=globaldb** 然后它工作正常

【讨论】:

  • 如果有人能解释一下为什么会这样工作,那就太好了:|
猜你喜欢
  • 2018-08-31
  • 1970-01-01
  • 2015-09-03
  • 2018-01-21
  • 1970-01-01
  • 2019-06-28
  • 2015-07-09
  • 2020-10-23
相关资源
最近更新 更多