M220J Paging Ticket

Hi @caspar_06973,
Welcome to the community!

do you get the same message?

Expected :Only the Dead
Actual :Wolf Hall

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?

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,

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

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,

Hello, MongoDB curriculum team!

I’ve got the same problem with this ticket. Has it been solved or am I doing something wrong?

Hi @Illia_Otlev,

Kindly allow me some time to crosscheck and get back to you.

Thanks for your patience.


I can`t complete the course without this ticket, and it’s the only one left.
I hope you can help me with that)

Thank you! Have a nice day!

Hello @Illia_Otlev and welcome to the community
are you getting the same message?

Expected :Only the Dead
Actual :Wolf Hall

Hello, Imad! Thank you!

No. This is my stacktrace:

And this is my stages:

Hello @Illia_Otlev, @Felipe_Lino
I checked the movie Of Men and War
and indeed the movie doesn’t have a tomatoes field,
Since Only the Dead also doesn’t have a tomatoes field, mongodb can’t consistently sort them by tomatoes.viewer.numReviews
Long story short, the team has to update the test cases and test on movies having tomatoes.viewer.numReviews

When I get some time (probably this night), I’ll work on a workaround solution

1 Like

I see. Thank you for the update!
If there is anything I can help you with, please let me know.

Then I will wait for the news.

See the following related thread.

1 Like

I like this idea

The easiest way to guarantee sort consistency is to include the _id field in your sort query.

thank you for the hint @steevej

1 Like
    Arrays.asList(new Document("$match", 
    new Document("genres", "History")), 
    new Document("$sort", 
    new Document("tomatoes.viewer.numReviews", -1L)), 
    new Document("$skip", 980L), 
    new Document("$limit", 20L))

Same issue - but i am getting Korengal both from the spring test as well as from the compass

If it is the same issue you should try the same solution.

1 Like

I can confirm that it works, if you add the “_id”-field in ascending order to your sorting.

I had some issues figuring out how to pass an ascending and descending BSON into the sort() function. You can make a list of BSON objects (I called it sorts), some of them “Sorts.ascending()”, some of them “Sorts.descending()” and then use “sort(Sorts.oderBy(sorts))” to add them to your query.

1 Like