首页 > 解决方案 > 猫鼬慢速选择不在模型中的特定字段

问题描述

当我使用 Mongoose Paginate 插件选择一些不在 Mongoose 模型中的字段 (b) 时

const transactionData = await TransactionModel.paginate(condition, {
            select: "a b c d e f g",
            sort: {createdDate: -1},
            lean: true,
            page: page,
            limit: limit,
            populate: {
                path: 'memberId',
                select: '_id username'
            }
        })

查询时很慢。然后我尝试删除 [b] 字段。它似乎比上一个更快。我需要知道为什么。

标签: mongodbmongoosepagination

解决方案


推荐阅读