【发布时间】:2020-04-08 13:10:23
【问题描述】:
我正在执行一个查询,要从数据库中获取数据,需要超过 6 秒,当我在 studio 3T 中执行相同的查询时,它执行得非常快。 我也执行了explain()
executionStats: {
executionSuccess: true,
nReturned: 932,
executionTimeMillis: 4,
totalKeysExamined: 0,
totalDocsExamined: 5149,
executionStages: [Object],
allPlansExecution: []
}
如您所见,执行时间很快,但返回结果需要 6 秒。 我正在打印时间看看它需要多少时间
console.log("Before", Date())
const posts = await Post.find({ author: author._id })
console.log("After", Date())
【问题讨论】:
标签: node.js database mongodb nosql