summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_skip.cpp
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2020-07-23 13:11:25 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-29 19:31:31 +0000
commit1dfde3f7a6ada7440c90301843e8b60335fb800c (patch)
tree148d0979e6081fd427366ff186db15c57e5058a5 /src/mongo/db/pipeline/document_source_skip.cpp
parent58283ca178782c4d1c4a4d2acd4313f6f6f86fd5 (diff)
downloadmongo-1dfde3f7a6ada7440c90301843e8b60335fb800c.tar.gz
SERVER-48848 Add support for $sample aggregation stage in grammar and CST
Diffstat (limited to 'src/mongo/db/pipeline/document_source_skip.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_skip.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_skip.cpp b/src/mongo/db/pipeline/document_source_skip.cpp
index f38036f0152..33fff89bcef 100644
--- a/src/mongo/db/pipeline/document_source_skip.cpp
+++ b/src/mongo/db/pipeline/document_source_skip.cpp
@@ -100,6 +100,7 @@ Pipeline::SourceContainer::iterator DocumentSourceSkip::doOptimizeAt(
intrusive_ptr<DocumentSourceSkip> DocumentSourceSkip::create(
const intrusive_ptr<ExpressionContext>& pExpCtx, long long nToSkip) {
+ uassert(15956, "Argument to $skip cannot be negative", nToSkip >= 0);
intrusive_ptr<DocumentSourceSkip> skip(new DocumentSourceSkip(pExpCtx, nToSkip));
return skip;
}
@@ -110,7 +111,6 @@ intrusive_ptr<DocumentSource> DocumentSourceSkip::createFromBson(
str::stream() << "Argument to $skip must be a number not a " << typeName(elem.type()),
elem.isNumber());
auto nToSkip = elem.safeNumberLong();
- uassert(15956, "Argument to $skip cannot be negative", nToSkip >= 0);
return DocumentSourceSkip::create(pExpCtx, nToSkip);
}