gpt4 book ai didi

node.js - 解释 ('executionStats' ) 和普通解释() 之间有什么区别

转载 作者:太空宇宙 更新时间:2023-11-04 01:55:33 24 4
gpt4 key购买 nike

我看到它们返回完全相同的东西,为什么要使用一个而不是另一个?

代码:

const explainQuery = collection.find().sort({last_modified:-1}).limit(1);
const researchQuery = collection.find().sort({last_modified:-1}).limit(1);
const explain = explainQuery.explain('executionStats');
researchQuery.toArray(function(err, data) {
func(err, data, explain);
})

enter image description here

最佳答案

explain接受一个可选参数,它是一个回调函数。您传递的字符串将被忽略,并且该函数返回一个 Promise:https://github.com/mongodb/node-mongodb-native/blob/2.2/lib/cursor.js#L1067

似乎值 allPlansExecution 已硬编码在驱动程序中 https://github.com/mongodb/node-mongodb-native/blob/fa0fbc0c4966dfaaf76f35c4de2e80876f53e825/lib/apm.js#L424

关于node.js - 解释 ('executionStats' ) 和普通解释() 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48112900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com