How to Paginate Query Results
Atlas Search queries might return many results. To make navigating results easier, you can either use pagination to divide results into discrete pages or use cursor iteration to view all the results for your query.
The following tutorials take you through the steps for paginating your query results:
The How to Paginate the Query Results tutorial describes how to use the
$search
searchAfter
andsearchBefore
options to build functions like "Next Page", "Previous Page", "Load More", and infinite scroll in your application. It also demonstrates how to use$search
searchAfter
andsearchBefore
with the$skip
and$limit
stages to jump across pages.The How to Iterate Your Cursor to View All Results tutorial demonstrates how to create an index and iterate the cursor until it is exhausted to return all results for a query.