小编Tak*_*kis的帖子

$expr 中的 mongodb $in 运算符不使用索引

我需要包含多个标识符的文档

它不起作用(冻结):

db.collection.aggregate([{
    $match: {
        $expr: {
            $in: ['$_id', [4, 6]]
        }
    }
}]);
Run Code Online (Sandbox Code Playgroud)

但它有效:

db.collection.find({
    _id: {
        $in: [4, 6]
    }
});
Run Code Online (Sandbox Code Playgroud)

mongodb aggregation-framework

2
推荐指数
1
解决办法
1811
查看次数

标签 统计

aggregation-framework ×1

mongodb ×1