Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

node.js - How to solve MongoError: pool destroyed while connecting to CosmosDB

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...