executionStats:带有nodejs和mongoose的DocumentDB

发布于 2025-01-28 11:13:47 字数 718 浏览 3 评论 0原文

我无法使用Mongoose和nodejs从DocumentDB获得executionStats

await model.find({ order_id: payload.order_id })
        .sort({ updated_at: -1 })
        .limit(1)
        .explain('executionStats')

同一命令从蒙古起作用,并返回执行时间。 但是,当我们尝试使用Mongoose时,我会遇到此错误:

MongoServerError: Field 'verbosity: allPlansExecution' is currently not supported
    at MessageStream.messageHandler (/my-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:753:20)
    at MessageStream.emit (events.js:314:20)
    at MessageStream.EventEmitter.emit (domain.js:483:12)

我需要一个内置的数据库进程来计算从Nodejs执行查询所花费的时间。但是上述过程不起作用。

关于如何实现这一目标或处理上述错误有任何想法吗?

I'm unable to get executionStats from DocumentDB using mongoose and NodeJS.

await model.find({ order_id: payload.order_id })
        .sort({ updated_at: -1 })
        .limit(1)
        .explain('executionStats')

The same command works from mongosh and returns the execution time taken.
But when we try using mongoose, I'm getting this error:

MongoServerError: Field 'verbosity: allPlansExecution' is currently not supported
    at MessageStream.messageHandler (/my-project/node_modules/mongoose/node_modules/mongodb/src/cmap/connection.ts:753:20)
    at MessageStream.emit (events.js:314:20)
    at MessageStream.EventEmitter.emit (domain.js:483:12)

I need a built-in Database process to calculate the time taken to execute a query from NodeJS. But the above process isn't working.

Any idea on how to achieve this or to handle the above error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文