Chapter 3 - Lab - $group and Accumulators (spoliers)

My pipeline results in different numbers for: highest_rating, lowest_rating, average_rating, deviation

The filter is very simple: “For all films that won at least 1 Oscar…”, and yet my results are not included in the multiple choice options – I didn’t even mess up in a predictable way?

[{
    $match: {
        awards: {
            $exists: true
        },
        type: 'movie'
    }
}, {
    $project: {
        'imdb.rating': 1,
        title: 1,
        has_oscar: {
            $regexFind: {
                input: '$awards',
                regex: 'Oscar?'
            }
        }
    }
}, {
    $match: {
        has_oscar: {
            $ne: null
        }
    }
}, 

2 things.

  1. The problem description is not clear enough and make us believe we need type:movie, but we do not.
  2. The regex Oscar? is not restrictive enough. See document with { "title" : "The Gold Rush" } which has not won an Oscar.

#1, That’s my bad.
#2, That’s an unreasonable task given the instruction in previous sections.

I’ll move on.
Thank you for saving me more wasted time.

1 Like