我有云函数,有如下代码,希望通过Explain解析数据库执行计划:
const templateList =
await collectionTEMPLATE
.aggregate()
.match({
isDeleted: _.neq(true)
})
.lookup({
from: 'EASY_VOTE_RESULT',
let: {
result_templateId: '$templateId',
result_openID: '$_openid',
result_selectedOptionIds: '$selectedOptionIds',
},
pipeline: $.pipeline()
.match(_.expr($.and([
$.eq(['$_id', '$$result_templateId']),
$.eq(['$$result_openID', openID])
])))
.done(),
as: 'EASY_VOTE_RESULT',
})
.skip(skip).limit(limit).end({
explain: true,
complete: console.log,
});
return templateList
可是,执行结果并不包含执行计划:
查询计划参见:
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/explain.html