$skip (aggregation)

On this page



Skips over the specified number of documents that pass into the stage and passes the remaining documents to the next stage in the pipeline.

The $skip stage has the following prototype form:

{ $skip: <positive integer> }

$skip takes a positive integer that specifies the maximum number of documents to skip.


Using $skip with Sorted Results

If using the $skip stage with any of:

be sure that you are performing a stable sort before passing results to the $skip stage. A stable sort ensures that the sort order of returned documents remains the same across multiple executions of the same sort; especially important when used with the $skip stage.

See the following for more information on each:


Consider the following example:

    { $skip : 5 }

This operation skips the first 5 documents passed to it by the pipeline. $skip has no effect on the content of the documents it passes along the pipeline.