Finding movies based on country 'Kosovo'

The filter “{“countries”: [“Kosovo”]}” on the movies collection returns 0 results, and filter “{“countries”: [“Russia”, “Japan”]}” returns two results. This is causing my test_projection.py to fail. Is anyone else having this problem? Is the total document count in the movies collection 46k for you as well?

mflix.movies

COLLECTION SIZE 61.85MB
TOTAL DOCUMENTS 46014
INDEXES TOTAL SIZE 36.63MB

@Greg_13811

The ticket ask

Write a query that matches movies with the countries in the “countries”
list.

You query just returns exact match. You can check doc here.

I’m having the same issue and I am using the $in operator. It isn’t returning anything on the first test and 2 records on the second test.

db.movies.find({“countries”: {"$in": [countries]}}, {“title”: 1, “_id”: 1})

If i put the array countries in “” it doesn’t return anything on either test. I did successfully run the unit test in compass passing Kosovo and Russia and Japan and got the expected results. Thanks.

I updated and passed [“Russia”, “Japan”] vs. the countries array and that test passed. So, I figure it is something in how I’m passing or handling the array. Thx

Updated, yes - needed to adjust the syntax on handling the array in the query. Fixed.

1 Like

db.movies.find({“countries”: {"$in": [countries]}}, {“title”: 1, “_id”: 1})

Don’t pass the array in the $in filter…