Mongoose DocumentDB太多光标
我有一个简单的RESTAPI使用Express.js Typescript和Mongoose在AWS上与DocumentDB群集一起运行。有时我会遇到一个错误,说我的光标太多了(10),并且数据库不再接受更多的读取操作。查询数据库后是否有办法关闭光标?
I have a simple RestAPI utilizing Express.js Typescript and Mongoose running on AWS together with DocumentDB cluster. Once in a while I get an error stating that I have too many cursors open (10) and the database just doesn't accept any more read operations. Is there a way in mongoose to close cursors after querying the database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Python提供了一种非常整洁的方法来管理上下文管理人员内部的数据库连接。 NPM具有类似的实现 -
上下文Lib
- 用于管理设置和拆卸过程。这里回答了一个类似的问题 - https://stackoverflow.com/a/a/a/71383627/19819810639Python provides a very neat way to manage the database connections inside Context Managers. npm has a similar implementation -
contextlib
- to manage the setup and teardown process. A similar question was answered here - https://stackoverflow.com/a/71383627/19810639