Sort Skip & Limit Question

I always assumed that it didn’t matter what order you use the sort, skip and limit functions(except when using the aggregation pipeline). I thought outcome will always be sort skip and limit in that order no matter how you arrange them. Am I wrong?

1 Like

I thought the same. And chose only the first answer to be correct in the final question 7.

1 Like

The last exam question is a trap. and two possible answers are !
I would agree that natural order is {sort, skip, limit} but {sort, limit, skip} works too. :frowning:

But it did not work for me. It always returns n documents as specified in limit(n), regardless the order of sort(), limit() and skip()!

yep, I just noticed your query.
It would be good to receive official reply.

This is where I got confuse. I chose the two right answers but got it incorrect because I chose the third one which did sort skip and limit.

Unless there was an upgrade with the most recent version(3.6 or higher) does it really matter what order you use?

There is parallel discussion on the subject in another course here.
I am completely lost.

Doubt about order or SORT, SKIP, LIMIT when using aggregation framework!

You are right, the answer was wrong!
The skip will happen before the limit, regardless of their order in the command.

We credited everybody for this question.

Thanks for pointing this issue out.

Regards,
Daniel.

2 Likes

Awesome. Thank you and the staff for looking it over.

hi Daniel,
you have credited the answer for the question, thank a lot.
Would you also change the final score (percentage) in the dashboard :slight_smile:
https://university.mongodb.com/dashboard/completed

1 Like

Yep same here. The final percentage on the course completion has not been updated. Thanks.

zjay87 and Yuri_52502,

I got our admin re-run the grading script on all students, and I verified the scores for both of you, and they look fine.

Regards,
Daniel.

1 Like

Thanks a lot !!!

Cool. Thanks a bunch!!!