Chapter 1: Basic Aggregation - $match and $project Optional Lab - Expressions with $project

I was able to identify the person(s) common to th cast, directors and writers arrays.
{
title: ‘Convict 13’,
cast: [‘Buster Keaton’, ‘Sybil Seely’, ‘Joe Roberts’, ‘Edward F. Cline’],
directors: [ ‘Edward F. Cline’, ‘Buster Keaton’ ],
writers: [ ‘Edward F. Cline’, ‘Buster Keaton’ ],
commonToAll: [ ‘Buster Keaton’, ‘Edward F. Cline’ ]
},
{
title: ‘The Frozen North’,
cast: [ ‘Buster Keaton’, ‘Joe Roberts’, ‘Sybil Seely’, ‘Bonnie Hill’ ],
directors: [ ‘Edward F. Cline’, ‘Buster Keaton’ ],
writers: [ ‘Edward F. Cline’, ‘Buster Keaton’ ],
commonToAll: [ ‘Buster Keaton’ ]
}

The problem statement says: " Note that your dataset may have duplicate entries for some films. You do not need to count the duplicate entries."

How do I remove the duplicates (titles?)

You can add a $group stage to the end of your pipeline to get a list of documents with unique titles.

Let me know if you can’t work it out and I’ll help out more. You’ve been doing well in figuring things out with hints in the past so I’ll let you try working this one out as well.

@Doug_Duncan
I added {$group: {_id: “$title”} } to the end of my pipeline and got a count of 1255 which is not one of the answers
…}, {$group: {_id: “$title”} } ]).itcount()

It seems like something is off earlier in your pipeline. It’s been a while since I tried to go through M121. If you want, you can send my your current query via a message and I can help you out. Of course you can post here as well since this is an optional lab and is not graded. If you post, please make sure you put the query in a code block for ease of copy/paste.

@Doug_Duncan
How do I send my code in a message?

Found it!! Sending code via message