Final Question 7

Does anybody see more than one correct answer here ??

if no,is there any order to use skip and limit ??

I think that if there was 2 answers they would allow us to select more than one.

If you think that skip and limit are order dependant, it takes less than 5 minutes to verify that in the shell, may be 10 minutes in a java program, and 30 minutes of reading links from google search.

The efficiency of the query can be impacted by the order of operations. See: https://docs.mongodb.com/manual/core/aggregation-pipeline-optimization/#pipeline-coalescence-optimization

While I think that page identifies the correct answer, the way I read it, the optimization is done automatically, which would make the 2 correct solutions the same?

The key for me was to remember how skip and limit work together.

  • If you limit the result how many should be skipped?
  • If you skip the result how you should limit?

I hope that makes sense.