I do not fully agree on the example solution for $unwind lab

The lab goes as below
“What is the name, number of movies, and average rating (truncated to one decimal) for the cast member that has been in the most number of movies with English as an available language?”

It is asking average rating for the one that appears for the most number of times in English movies.

In the solution, it places the match stage right at the beginning of the pipeline.

$match: {
  languages: "English"
}

And after that, it calculates the average rating. This way, it becomes the average rating of english movies that a person is in the cast.

Luckily, this solution works because the number of movies equals to the the number of english movies that the cast starred in. However, still I believe, the question or the solution should be corrected.

e.g. “What is the name, number of movies with English as an available language, and average rating (truncated to one decimal) of the movies with English as an available language for the cast member that has been in the most number of movies with English as an available language?”

For example, imagine the following case.

  • A person has been in a 120 movies
  • Out of 120 movies, only 110 movies are available in English
  • Still, the person is the one who has been in the most number of movies.
  • In this case, are we supposed to calculate the average rating of 120 movies or 110 movies?
  • With current problem statement, we should calculate the average rating of 120 movies
  • However, the solution is calculating the average of 110 movies (by applying match right at the beginning)
3 Likes

Hey @hyun_chae,

I understand that in the current version of the course, the lab statements are not accurate and might trigger certain edge cases.

I really appreciate the learners’ patience while they are taking this course and actively sharing the feedback.
We are working on revamping this course and our focus is to create a smooth learning experience for our users. Meanwhile, I would recommend you to simultaneously look into the documentation and practice the examples to better understand the concepts.

Feel free to reach out if you have any questions.

Kind Regards,
Sonali

2 Likes