标签: mongodb mongoose database-performance
populate 和 findById 在性能上有什么区别?哪个更快?
示例
findById:
const comment = await Comment.findById(commentId); const user = await User.findById(comment.userId);
填充:
const comment = await Comment.findById(commentId).populate('userId');