如何解决MongoError:连接到CosmosDB时池被破坏 [英] How to solve MongoError: pool destroyed while connecting to CosmosDB

查看:59
本文介绍了如何解决MongoError:连接到CosmosDB时池被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Node.js服务,我在其中使用mongo-API与Document/Cosmos DB进行通信. 我的服务运行正常,并执行了所有操作,但是1分钟后,该服务抛出了mongo错误.

I have Node.js service in which I am using mongo-API to communicate with Document/Cosmos DB. My service run's fine and performs all the crud operation but after 1 min some mongo error throws from the service.

/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)

我无法理解为什么会出现此错误.请提出需要做的更改以解决此错误.

I am not able to understand why this error is coming up.Please suggest the changes that need to be done to resolve this error.

推荐答案

我遇到了同样的问题,删除了连接字符串mongodb中的副本集参数: ........./?ssl=true**&replicaSet=globaldb** 然后就可以了

I run into the same problem, removed the replica set parameter in the connection string mongodb: ........./?ssl=true**&replicaSet=globaldb** then it worked fine

这篇关于如何解决MongoError:连接到CosmosDB时池被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆