Chpater 5 - Quiz 1: sort() and limit()

Hi,

Question is wrong depends on the data. We should not check the data.
Logically, we do first sorting then do limiting. Question accepts vice versa. You are contradicting yourself.

Please check.

2 Likes

Hi @Umut_Tekin,

It may appear that when you reverse the order of sort and limit, it wouldn’t give you the right results but MongoDB flips their order when executing the query, delivering the results that the question prompt is looking for.

1 Like

Hi,

Yes, that’ s exactly what I’ m talking about. It wouldn’ t give the right results. So, you have to check both of them. When results set change depending on the order of sort and limit, MongoDB shows 2 different replica set :)? It shouldn’ t. A query gives a result set, not two.

Either, you have to provide copy - paste options for that question to check results or you have correct the answer the way conform all possible conditions.

3 Likes

Then you mean to say that sort and limit need not to be in an order as mongo adjusting by itself?