在投影文档上使用 toObject({getters:true}): applyGetters 会迭代所有模式路径,每个未选中的路径都会触发 O(projectionKeys) isSelected 扫描 – 每个文档 O(paths x projection)
作者: tsushanth创建于 2026年7月7日更新于 2026年7月28日
标签performance
toObject({getters:true}) 在投影文档中: applyGetters 迭代所有模式路径,每个未选中的路径都会触发 O(projectionKeys) isSelected 扫描 - O(paths x projection) per doc
内容来源: Automattic/mongoose