$skip (aggregation)
정의
$skip
Skips over the specified number of 문서 that pass into the stage and passes the remaining documents to the next stage in the 파이프라인.
$skip
단계의 프로토타입 형식은 다음과 같습니다.{ $skip: <positive 64-bit integer> } $skip
takes a positive integer that specifies the maximum number of documents to skip.참고
MongoDB 5.0부터
$skip
파이프라인 집계에 64비트 정수 제한이 있습니다. 이 제한을 초과하여 파이프라인에 전달된 값은 잘못된 인수 오류를 반환합니다.
행동
Using $skip with Sorted Results
$skip
단계를 다음 중 하나와 함께 사용하는 경우:
$sort
집계 단계,sort()
메소드 또는sort
0} 필드를findAndModify
명령 또는findAndModify()
셸 메서드에 추가합니다,
$skip
단계로 결과를 전달하기 전에 정렬에 고유 값을 포함하는 필드를 하나 이상 포함해야 합니다.
Sorting on fields that contain duplicate values may return a different sort order for those duplicate fields over multiple executions, especially when the collection is actively receiving writes.
정렬 일관성을 보장하는 가장 쉬운 방법은 정렬 쿼리에 _id
필드를 포함하는 것입니다.
각각에 대한 자세한 내용은 다음을 참조하세요:
예시
다음 예를 고려하십시오.
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.
다음도 참조하세요.