Limiting, Skipping, and Sorting Documents
So far, we have learned how to write basic and complex queries and to project fields in the resulting documents. In this section, you will learn how to control the number and order of documents returned by a query.
Let's talk about why the amount of data a query returns needs to be controlled. In most real-world cases, you won't be using all the documents your query matches to. Imagine that a user of our movie service is planning to watch a drama movie tonight. They will visit the movie store and search for drama movies and find that there are more than 13,000 of these in the collection. With such a large search result, they might spend the entire night just looking through the various movies and deciding which one to watch.
For a better user experience, you may want to show the 10 most popular movies in the drama category at a time, followed by the next 10 in the sequence, and so on. This technique of serving data is known...