summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_skip.cpp
diff options
context:
space:
mode:
authorU-tellus\cwestin <cwestin@10gen.com>2012-02-24 10:42:34 -0800
committerU-tellus\cwestin <cwestin@10gen.com>2012-02-29 20:33:52 -0800
commit00498dc20f070394d9d42e1d40e6dadd0ff54e0a (patch)
tree22a12bf5a16f5fc69bd80358a58c79c7d7e87555 /src/mongo/db/pipeline/document_source_skip.cpp
parentd5bcc464a0479a2a07ab5299dc2b34c760857ea5 (diff)
downloadmongo-00498dc20f070394d9d42e1d40e6dadd0ff54e0a.tar.gz
SERVER-4843
Diffstat (limited to 'src/mongo/db/pipeline/document_source_skip.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_skip.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document_source_skip.cpp b/src/mongo/db/pipeline/document_source_skip.cpp
index 605f85e7f92..6831795cf21 100644
--- a/src/mongo/db/pipeline/document_source_skip.cpp
+++ b/src/mongo/db/pipeline/document_source_skip.cpp
@@ -107,14 +107,17 @@ namespace mongo {
intrusive_ptr<DocumentSource> DocumentSourceSkip::createFromBson(
BSONElement *pBsonElement,
const intrusive_ptr<ExpressionContext> &pExpCtx) {
- uassert(15972, str::stream() << "the value to " <<
- skipName << " must be a number", pBsonElement->isNumber());
+ uassert(15972, str::stream() << DocumentSourceSkip::skipName <<
+ ": the value to skip must be a number",
+ pBsonElement->isNumber());
intrusive_ptr<DocumentSourceSkip> pSkip(
DocumentSourceSkip::create(pExpCtx));
- pSkip->skip = (int)pBsonElement->numberLong();
- assert(pSkip->skip > 0); // CW TODO error code
+ pSkip->skip = pBsonElement->numberLong();
+ uassert(15956, str::stream() << DocumentSourceSkip::skipName <<
+ ": the number to skip cannot be negative",
+ pSkip->skip >= 0);
return pSkip;
}