更新时间:2023-02-09 21:54:42
steps.step
在这种情况下计算为字符串数组 ["s1", "s2"]代码>.常规的
$lookup
支持这种比较,并在后台执行 $in
.
steps.step
evaluates to an array of strings in this case ["s1", "s2"]
. The regular $lookup
supports such comparison and does $in
behind the scenes.
在您的第二个示例中,您使用的是 $expr
因此您需要使用表达式语言,因此您必须使用 $in 运算符:
In your second example you're using $expr
so you need to use expression language hence you have to use $in operator:
$expr: { $in: ['$_id', '$$stepId'] }