在 MongoDB 聚合管道中,字段之间的匹配

问题描述 投票:0回答:1

我有一部分聚合管道正在使用正在运行的代码

$expr: {$in: ["$myCompanyBidsData._id", "$bestCompanyBids._id"]},

我想要获取

_id
a 的
myCompanyBidsDat
_id
中某个对象的
listbestCompanyBids
不匹配的数据。

我尝试使用

$nin
,而不是
$expr
内部/外部,但它不起作用。

mongodb aggregation-framework
1个回答
0
投票

试试这个。如果没有看到查询,我无法给出更完整的答案。

{
  $match: {
     $expr: {
         $not: {
             $in: ["$myCompanyBidsData._id", "$bestCompanyBids._id"]
         }
     }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.