Chapter 2 Lab 2

In this lab, do we have to calculate the normalized rating and scaled votes, before $match stage(i.e. for matching documents with release year more than 1990 and ratings and votes are more than 1)?

Thanks
Apurva

Hi,

The $match stage should be the first one, and the normalization should be done in a later $project stage.

José Carlos

1 Like

What’s the difference between year and released?
I ask this because earlier I assumed, they’re both the same, but they have different values in many documents.

Thanks
Apurva

Hello,

Use the year field, I had problems with the released date-time field which allowed documents through which caused a problem on $sort.

I successfully project’d the $year out of the released field, so I could test the year value, in a later $match, which all worked. However when I came to perform a $sort on the normalised value, the $sort keep throwing an error.

So stick with year and your life will be simpler.

And yes, the use of the word “Released” in the question, is confusing. When you get it running and put the correct answer in, look at the proposed solution in the detailed answer.

1 Like

Hi,

Thank you very much for pointing this out, I agree it’s confusing. The field you should use is year. Will ask the team to review the wording of the question.

José Carlos

1 Like

I used the year component of the released field and still got the correct answer.

Hi,

Do I understand correctly the question of Ch.2 Lab.2 : we need to find the lowest normalized_rating among the four given movies rather the lowest ? I got a bunch of movies with normalized_rating =1 ???

Hi Yuri_52502,
You can refer to the handout scaling.js in which there is formula as a hint to calculate the rating required.