$setIntersection gives me null object Chapter 2 lab 1

why $size not doing its job…

Most likely, setIntersection fails to produce an array, as required by $size, because one of its argument is not an array itself or does not exists. It is clear than in your case the 2nd argument is an array. The problem must come from the cast field. May be the cast field does not exist for some document. A match stage can take care of this issue by filtering out documents that do not have a cast field.

Congrats for having each field as a separate variable.

Hi @ElMas_Chingon,

I see that you have successfully completed the lab. :clap:

Please feel free to reach out if you have any additional questions.

Kind Regards,