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

Hello,

Anyone can give me a hint of what the problem is?

I should get 23 but got 24.

  • imdb.rating is at least 7
  • genres does not contain “Crime” or “Horror”
  • rated is either “PG” or “G”
  • languages contains “English” and “Japanese”

db.movies.aggregate(pipeline).itcount()

Many thanks.

1 Like

Get rid of $or and find an operator that will cater for the genre conditions. Or if you want to keep the $or, then you have to also include an explicit $and condition to wrap all the conditions inside the match stage in place of the commas (aka implicit AND).

PS: Suggest you edit your post as it’s against forum guidelines to post potential lab answers.

1 Like