猫鼬响应速度慢,但mongo图集显示快速查询

时间:2020-01-23 15:02:32

标签: node.js mongodb mongoose mongodb-atlas

我正在运行这段代码,这在两个控制台日志之间花费了太多时间(〜12秒)。之前,我认为这与猫鼬无法建立连接有关,为此,我增加了机器可用的最大连接数。

但是,我现在可以肯定地说不是,因为连接总数徘徊在配置限制的1/4处。此外,mongo地图集还说查询仅花费了100ms。我正在尝试找出可能导致此行为的潜在原因,或者是对此进行更深入调试的方法。

console.log(`mq # ${this._model.modelName} # find`);

let data: S[] = await this._model.find(findQuery.condition).session(session).select(findQuery.select).slice(findQuery.sliceField, findQuery.sliceNumber)
                .sort(sort).skip(Number(findQuery.start)).limit(Number(findQuery.count)).populate(populateFields).populate(populatePaths);


console.log(`mr # ${this._model.modelName} # find`);

0 个答案:

没有答案