Single argument to $in

I am confused by the use of a single argument to $in in Lab: Using Cursor-like Stages.

Without giving away spoilers I got the correct answer but had to implement additional stages because I had no idea that this would work:

cast: {
$in: favorites
}

Can someone explain please?

Welcome @mikeh1980!

Here’s the $in operator documentation for reference, just in case.

In this scenario favorites is a variable of type array. This variable was declared before the pipeline. You can replace favorites with the array and it will still work.

Hi @mikeh1980,

Please check your discourse inbox for details regarding this.

Thanks,
Sonali