Cursor Methods and Aggregation

I have watched this three times now and don;'t see the relationship to displaying multiple pages of data. And i missing something. Not even sure where to start.

Hi @jurgenmack,

The lecture introduces the concept of $skip and $limit stages which is directly linked to paging. Let me try explaining:

Suppose, you want to display 5 items in your first page and there are 20 records in total. Questions that might come in one’s mind:

  • How will I restrict the output to 5 items
  • How will I make sure the items 5-10 are displayed on second page.

So, suppose for first page, we want to display 0-5 items, so aggregation stages will look like this:

{ $skip: 0 },
{ $limit: 5 }

For second page, we would skip the first 5 items and display the next items:

{ $skip: 5 },
{ $limit: 5 }

For reference, please view documentation.


At the risk of sounding stupid. I still don’t see it, nowhere in the lesson can i see an explanation on how multiple pages are loaded. I don’t see a pipeline or an aggregation statement.



Hi Jurgen,

The lesson “Chapter 2: User-Facing Backend, Cursor Methods and Aggregation Equivalents” starts with general cursor management, and covers aggregation pipeline specifically from 5:00 onwards. Let us know if you are not seeing this.

Since you have completed the course setup you should have access to the course file for this module, test/lessons/cursor-methods-agg-equivalents.spec.js.

Reviewing the file data may make the material clearer to you.

Kind regards
MongoDB University Team