M220J Paging Ticket

Hi Kushagra,
I’ve a problem with M220j Ticket: Paging.
I can’t pass the PagingTest.java

Here is the error:

org.junit.ComparisonFailure: Expected title field does match: Please check your getMoviesByGenre() movies sort order.
Expected :Only the Dead
Actual :Wolf Hall

Looking at the parameter passed to the method by the test, I have tried this filter on compass.
{
filter: {
genres: {
$in: [
‘History’
]
}
},
sort: {
‘tomatoes.viewer.numReviews’: -1
},
skip: 980,
limit: 20
}

The result shows as the first movie “Wolf Hall”, while the Expected “Only the Dead” is the third.

Here below, my java code.

public List<Document> getMoviesByGenre(String sortKey, int limit, int skip, String... genres) {
    // query filter
    Bson castFilter = Filters.in("genres", genres);
    // sort key
    Bson sort = Sorts.descending(sortKey);
    List<Document> movies = new ArrayList<>();
    // TODO > Ticket: Paging - implement the necessary cursor methods to support simple
    // pagination like skip and limit in the code below



    moviesCollection.find(castFilter).sort(sort).limit(limit).skip(skip).iterator()
    .forEachRemaining(movies::add);
    return movies;
}

Can you explain to me, what is wrong with it?

Thanks for the attention.

Hi Roberto,
Can you get the ticket? if you do, just carry on.
for more information about this issue check:

Just a report here that I met the same problem.

Hi @caspar_06973,
Welcome to the community!

do you get the same message?

Expected :Only the Dead
Actual :Wolf Hall

Yes,
I think the answer should be the make sure the sequence of order/skip/limit ,
but what ever I tried, all the same result.

can you get the ticket with a failing test?

Sorry I can not pass the PagingTest, so I cant get the validation code.

What do you mean by “get the ticket” ?

Hi everybody,
I have the same problem too on this ticket:

Expected :Only the Dead
Actual :Wolf Hall

Are there any updates on this issue in order to fix it?
Thanks.

Hi @Roberto_Olivieri, @Gabriele_Vinucci & @caspar_06973,

We welcome you all to the MongoDB Community.

Thanks for highlighting this…!!

I apologize for the late response.
We are looking into it, kindly allow us some time.
We will surely get back to you soon with an update.

Meanwhile, as @Imad_Bouteraa stated if you are getting the validation code for this ticket, just carry on for now.

We really appreciate your patience.
Good luck with the rest of the course.

Kind Regards,
Kushagra

I have the same problem:

org.junit.ComparisonFailure: Expected title field does match: Please check your getMoviesByGenre() movies sort order.
Expected :Only the Dead
Actual :Of Men and War

public List<Document> getMoviesByGenre(String sortKey, int limit, int skip, String... genres) {
    // query filter
    Bson castFilter = Filters.in("genres", genres);
    // sort key
    Bson sort = Sorts.descending(sortKey);
    List<Document> movies = new ArrayList<>();
    // TODO > Ticket: Paging - implement the necessary cursor methods to support simple
    // pagination like skip and limit in the code below
    moviesCollection.find(castFilter)
            .sort(sort)
            .skip(skip)
            .limit(limit)
            .iterator()
    .forEachRemaining(movies::add);

Hi @Felipe_Lino,

Please accept our apologies for any inconvenience caused.
Just to let you know, the task has been assigned to the team.
We expect it to be live soon. Moreover, I will make sure to fix this as soon as possible.

Thanks for your understanding.

Best regards,
Kushagra