Chapter 1: Basic Aggregation - $match and $project Lab - $match

Am not getting 23 am getting 24 for document count

First, you are not supposed to post lab answers even if wrong.

Without, hopefully, not being to obvious.

  • An Horror movie is not a Crime movie
  • A Crime movie is not an Horror movie
  • So an Horror movie is (not a Crime or not an Horror)
  • And an Crime movie is (not a Crime or not an Horror)

@steevej-1495 sorry sir am not able to understand the thing that you trying to convey me like i gave the condition that both value shouldn’t be there then its giving 0 document as count.

Is the collection is updated with extra document?

Thank you @steevej-1495 finally i understood the point.

yes, even i am getting 24. how to correct it?

@Vijaya_21736,
Use correct Logical Query Operators and understand the situation correctly to get the exact result.

I get 5. They meet all criteria. Hard to see where I’ve filtered out the other supposed 18 that meet. It’s supposed to be in BOTH English and Japanese isn’t it? Not either?

@ Brian_18814

I guess the obvious question is did you get the correct answer on the first lab? If so, then you should be using the same $match here and should get the same number of movies.

To answer your specific question: Yes, the languages are supposed to be both English and Japanese.

I can’t see how my filter is wrong. I’m getting only 5 documents. I’ve found no documents at all have “Crime” or “Horror” genres. So I guess there can’t be anything wrong with that filter. “genres”: {$in: [“Crime”, “Horror”]
The five I’m getting meet all the criteria: imdb.rating gte 7; languages: both En and Jap; rated: “PG” or “G”.
But I don’t see what I’m doing wrong. I should be getting 23 docs apparently.

I’ve found it. I was using “languages”: [“Japanese”, “English”] but that requires both English and Japanese and not other languages. The $all fixes it.

1 Like

Thanks Brian…actually i struggled 2 day to get 23 documents…but $all fixes my issue for languages

First off, i m unable to use video db , using the information provided in the lab. Steps on how you got there?

Only use the aggregations db. Other dbs are not available for this course.

Why is following imdb.rating is at least 7

  • at least
    • not less than; at the minimum
      • “clean the windows at least once a week”

when it should be at most

@Igor_05290
At most = maximum or must not exceed
At least = minimum or from

Is that not what i posted above ?
In terms of operations:

  • To be at least 7 ==> $x > 7
  • To bet at most 7 ==> $x < 7

:+1:

I was just wondering why you think it should be “at most”?

Something missing here though.

Based on the $match constructed in the exam with i was not getting properl results, after some thought i tried to change from at least to at most and it got me the right answer to the exam.

You can try to redo the exam and see for yourself.

We can take this off webiste and compare $match if you want.

What I’m highlighting here is it should be $x >= 7 and not $x > 7.

If you get a chance, have a look at the detailed answer and you’ll see exactly how the answer was derived.
image

hmm, the thing is that i have used {$lt: 7}, and it was the same answer.

Guess a low probability coincidence, as for >= that is correct.

No objections further.

You can understand my suspicious that question might be wrong formatted.