Chapter1 Optional Lab another solution

I had another solution. it able distinct result.
I got 1255 unique “labor of loves”. is it correct?

{$unwind: “$cast”},
{$unwind: “$directors”},
{$unwind: “$writers”},
{$project: {title:1,“labor_of_love”: {$cond: [ { $and: [{ $eq: [ “$directors”, “$cast” ] }, {$eq: ["$directors", “$writers”]}]}, 1,0 ]} }},
{$group: {
_id: “$title”,
“labor of love”: { $sum: “$labor_of_love”}
{$match: {“labor of love”: {$gte: 1}}}

@Leonid_75050, “labor of love” is not the name of a movie. All you need to do is find how many movies have the same cast, writers and directors.

@kanikasingla, @Sonali_Mamgain I couldn’t find who looks after this course but from trends I can see that both of you are the frequent Curriculum Support Engineer posters :wink: :+1:
This “labor of love” expression is causing a lot of confusion. Anything you can do to redact it from current/future courses?

@007_jb are You joke that I didn’t correct understand task description?
Please re-read slowly my item. Thanks.

Apologies @Leonid_75050 :worried:. I missed this! :see_no_evil: A lot of us got confused about this line that’s why I mentioned it.

To solve this task, you need to do something with the writers field before you apply the condition.