首页 > 解决方案 > Mongodb对查找功能不区分大小写

问题描述

下面的代码是我如何为我的查找功能进行排序:

{
    $lookup: {
        from: 'members',
        let: { abc: '$abc' },
        pipeline: [
            {
                $match: { $expr: { $in: ['$_id', '$$abc'] } }
            },
            { $sort: { name: 1 } }
        ],
        as: 'cde'
    }
}

现在我想让排序不区分大小写。我知道通常我们可以使用collation: { locale: 'en' }. 但是如何将它添加到查找函数中呢?

标签: javascriptmongodbaggregation-frameworklookup

解决方案


推荐阅读