Missing fields in example collection / validateLab1(pipeline)

Could it be that the data in the movie collection has changed since the course was released?

I have this pipeline that should check all the boxes of the first assignment, but I find that the data is missing fields like rating or languages so the count can’t really match and the validation script can’t work correctly.

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

What am I missing here?

without validation step, try running each one of the operations you wrote inside the match stage separately: “imdb.rating”, “genres”, “rated”, “languages”, and check if you are getting results from them. only after that try combining them into the “match” stage.

Not all documents have all these fields.

You’re currently looking for films that have at least English or Japanese languages available, where the question asks you to return films that have both languages available. If you fix that I believe you’ll have your answer.

1 Like

Hello Doug_Duncan!

Thank you for this tip.
Although I have already been using MongoDB in production for a while now, I have learned new things here all the time. I will keep coming to improve my skills.



This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.