M121 Chapter 1: Optional Lab: Wrong Answer


I do not understand why the answer I’m getting is not the correct one. Please, I want to discuse my answer in-box (discourse) as I do not want to display it here.


Well, as I could not get nobody interested from the staff after 2 days to discuss in-box, I’m obliged to publish my solution which is giving a wrong answer. I do not know what is wrong, I hope somebody can help me.

var e = [{$match:{“cast”:{$exists:true},
labors_of_love:{$size:{$setIntersection:["$cast","$directors","$writers"]}} }},

You need to transform writers values.
Some values are in the format: Jon Connolly (story). this will not match if casts and directors filed has Jon Connolly.
Hint: $map operator

Thanks Mahesh_56388, I already found the solution.

By the way, adding a hint to check the data available before diving in coding as a best practice will be appreciated by many learners.

Jaime :coconut: :space_invader:

1 Like

Hi @jhrozo,

Apologies for late reply here!!

I am glad that you were able to debug and resolve the issue.

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


I’m working on Atlas Movies collection
This Code gives me outcome: 896
but it is not one of the quiz answers. What did I do wrong?

The first thing would be to format and indent your code correctly. The pre or code html tag could be use and in this forum you might use triple back ticks at the beginning and end of your code.

The $project where writers is projected twice might be problematic.

1 Like

Hi Steevej

I completed the code, and got the right answer, but I am wondering if there is a simpler way of doing it. Presently my code uses 3 $project stages and 2 $match stages - doing this because of the restriction of not being able to use a variable in the same stage it was created in. Is the number of stages I’m using correct?

Hi @Darwin_LeMay,

I have initiated discourse inbox thread with you. You can share your aggregation pipeline there.

Additionally, you can refer to the following documentation link:

Let me know if you have any questions.

Kind Regards,

Hi Sonali - how do I access the discourse server?

Hi @Darwin_LeMay,

Click your icon on the Top right corner of the discourse.
Then, click on the notification symbol to the the messages that you have received from me.

Check the screenshot below:

If you are still facing any issues, please feel free to reach out.

Kind Regards,

Thanks Sonali - I think I am good for now.

1 Like

Hello, can anyone tell me what’s wrong with my query?








  in: {

    $arrayElemAt: [


        $split: [ "$$writer", " (" ]










“commonToBoth”: {





“commonToBoth”:{$exists:true, $ne:, $ne:null}



{ $group : { _id : “$commonToBoth” } },


First filter out the null values and then proceed.

Does the shell complains about a syntax error?

You are having the wrong result?

Do you get any documents?

Do you get documents and they are they wrong?

We need more information.