翻译或纠错本页面

$skip (aggregation)

On this page

Definition

$skip

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.

Example

Consider the following example:

db.article.aggregate(
    { $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.