Error in Chapter 2: Basic Aggregation - Utility Stages Lab: Using Cursor-like Stages

I think I found and error in :

The detailed step:
Then, we will be projecting the num_favs value by calculating the $size of the array intersection, between the given set of favorites and the film cast:

It’s not related to the problem, it should be:

Edit: Deleted the aggregation pipeline.

I just found this error too and came here to post about it.
Totally agree, starPower field name is unrelated to the lab and it should be num_favs instead.

Hi @Fabrizio_Cirelli, @Alexander_08031

Thanks for pointing this out!!

We will be updating this detailed answer soon.

Kind Regards,

Can I define the favorites array in the mongo shell with something like var favorites = [...] and use this inside the aggregation pipeline?

Sure. The mongo shell is a JavaScript interpreter.

I have tried use a pre defined variable with single $ and double $$, it didnt worked.

It is a variable, not $, nor $$, nor anything is needed.

Hi @Joao_Leonardo_Lemos,

Are you able to create the variable?

If you are facing any issues, please share the command that you are using and we can work together in debugging and fixing it.