The question could be clearer on this, but what is actually expected here is documents matching ANY of the items in the list as opposed to ALL items as your code currently implements.
Of course the best way is to actually read the code in the tests ( as the questions do instruct you to do ) and at least see what arguments are being passed and the expected number of results. This will then give you some indicator as to whether you are using the correct query operators and expressions.
SIDE NOTE: Not really important to the answer, but the
await keyword usage in the provided code template is actually incorrect.
.find() is not actually an async method in itself, and therefore does not require an
The only actual async function call here is the
toArray(), and you don’t need to
await that since
getMoviesByCountry() is the actual method returning the Promise that requires the
await, and that is done within the test file itself.
So for example your
console.log(`movieDao result: `, cursor.toArray())
testing statement should actually have been
console.log(`movieDao result: `, await cursor.toArray())
Otherwise it’s just a Promise still and not the result. But don’t do that since you can only iterate the cursor result once. Test your queries using the
mongo shell before you code instead.
Also READ the test code but DON’T change it under any circumstance.