Lab $match: I can't get 23 document

I tried several pipeline:

#1
var pipeline = [ { $match: { “imdb.rating”: { $gte: 7 }, $or: [{genres: { $ne : “Crime” }},{ genres: { $ne: “Horror”}} ], rated: { $in: [“PG”, “G”] }, languages: { $all: [“English”, “Japanese”] } } } ];

#2
var pipeline = [ { $match: { “imdb.rating”: { $gte: 7 }, genres: { $not: { $all: [“Crime”, “Horror”] } }, rated: { $in: [“PG”, “G”] }, languages: { $all: [“English”, “Japanese”] } } } ];

#3
var pipeline = [ { $match: { “imdb.rating”: { $gte: 7 }, “genres”: { $elemMatch: { $nin: [“Crime”, “Horror”] } }, “rated”: { $in: [“PG”, “G”] }, “languages”: { $all: [“English”, “Japanese”] } } } ];

All i get is 24 documents. Please help me

Please check our forum
You will get tips/clues

Difference between $all and $and

1 Like

Hi, I’m having the same problem. All i get is 24 documents. When I check the output, everything seems fine.
These are my querys:

Don’t know if I’m understanding wrong the filter criteria.

Thanks in advance.

First, verify the requirements:

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

Hi @Nicolas_Gomez,

I see that you have successfully completed the lab. Glad that you were able to resolve the issue :clap:

Please feel free to reach out if you have any questions.

Thanks,
Sonali