Projection: The return from the api was incorrect when searching by country

All though the tests have been successful Still I am not able to generate code.

Bson projection = new Document();
//TODO> Ticket: Projection - implement the query and projection required by the unit test
List movies = new ArrayList<>();
//System.out.println(Arrays.toString(country));
Bson queryFilter = and(
// matching tom hanks
in(“countries”, country)
);

    //System.exit(0);
    moviesCollection.find(queryFilter)
            .projection(fields(include("title")//,excludeId()
            ))
            .into(movies);
    //System.out.println(Arrays.toString(new List[]{movies}));
    return  movies;

Not sure if it will help, but the and() looks unnecessary if you use only one condition.
Otherwise it looks like what I did.

Do you get an error or exception? Any stack trace?

Got the issue. I had to restart the application. It was not auto restart as in eclipse.

1 Like