Query.prototype.explain()
Parameters
- [verbose] «String» The verbosity mode. Either ‘queryPlanner’, ‘executionStats’, or ‘allPlansExecution’. The default is ‘queryPlanner’
Returns:
- «Query» this
Sets the explain
option, which makes this query return detailed execution stats instead of the actual query result. This method is useful for determining what index your queries use.
Calling query.explain(v)
is equivalent to query.setOption({ explain: v })
Example:
const query = new Query();
const res = await query.find({ a: 1 }).explain('queryPlanner');
console.log(res);
当前内容版权归 mongoosejs 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mongoosejs .