Chapter 1 - Ticket: Projection


I’m trying to run the test case for getMovieByCountry but it fails every time. I’ve written correct code for, can some one pls help me what is wrong with code here.

public List getMoviesByCountry(String… country) {

Below is my code from class.

Bson queryFilter = new Document("Countries", new Document("$all", Arrays.asList(country)));
Bson projection = new Document("title", 1);
List<Document> movies = new ArrayList<>();
//TODO> Ticket: Projection - implement the query and projection required by the unit test
return movies;


This is correct but you may want to recheck about array query operator for querying you are using. As $all will match only those arrays containing all mentioned countries.

Also, the error in the console when you run unit test or integration test will help you debug the code.


Hi Kanika,

Thanks for your reply. Below is test scenario where expectedSize is 2 and acutalSize is 0, and my test case fails with same error msg.

DAO calling statement and passing country as argument.
String country = “Kosovo”;
Iterable cursor = dao.getMoviesByCountry(country);

Assertion statement:
“Unexpected number of returned movie documents. Check your query filter”,

@pavann24, are you sure the field is named Countries?

1 Like