Lab: $group and Accumulators

I am not clearly understanding what we have to use for grouping the documents before applying the accumulators like $max, $min, $avg, $stdDevPop.
[In the last lab, we calculated a normalized rating that required us to know what the minimum and maximum values for imdb.votes were. These values were found using the $group stage!]

Take a look at the following:

That was part of the handout and there is many example of $group.

After filtering the resultset for ‘Won Oscar’ films, document count is 1262, and then I am grouping on id as null and applying the accumulators. I am also using “$stdDevSamp” for deviation but o/p is not matching with one of the option, would you mind validating the filtered document count ?

I am not sure if this is the number you want but I am getting 914 movies that won at least 1 oscar. I don’t want to write the pipeline I used to get that number since it gives part of the answer to the lab. However I can say that the first stage was a $match with $regex on the award field so that only movies with Won Oscar are passed to the second stage. And the second stage was simply a $group using $sum : 1.

Correct, I am also getting 914 as count. I am using computation field from previous lab in the project stage after $match, and then $group and then accumulator of $min within group for lowest_rating. I am not finding 2.75 in any of the options ?

lowest_rating: {$min: “$normalized_rating”}

They are not interested with the normalized rating of the previous lab. It is simpler. The problem is stated as

calculate the standard deviation, highest, lowest, and average ‘imdb.rating’
1 Like