我有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)
我无法理解为什么会出现此错误。请建议为解决此错误而需要进行的更改。
答案 0 :(得分:6)
我遇到了同样的问题,删除了连接字符串mongodb中的副本集参数:
........./?ssl=true**&replicaSet=globaldb**
然后它运作良好