Aggregation pipeline for $match


Help MongoDB pick a movie our next movie night! Based on employee polling, we’ve decided that potential movies must meet the following criteria.

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

Attempted solution:
(Removed partial solution)

The above query is returning an incorrect number of documents. Can anyone tell me what’s wrong?

For genres, find an operator that is the opposite of $in.
For languages, your current condition is finding English or Japanese which is equivalent to $in. You need to find an array operator that can do English and Japanese.

PS: To keep in-line with forum guidelines, potential answers to labs shouldn’t be posted. Suggest you delete the pipeline from your post.

1 Like