diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-09-30 18:53:53 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-10-11 13:00:53 -0400 |
commit | 257292ade0ce14ca4785ca9889b0579be8a3e36b (patch) | |
tree | f112929c9f8d9f8ccb23d2bd82fc6bd77694c22c /src/mongo/db/pipeline/document_source_project.cpp | |
parent | e76e27acacd2e2665e741be3cb58b4071f6616a4 (diff) | |
download | mongo-257292ade0ce14ca4785ca9889b0579be8a3e36b.tar.gz |
Don't require a pointer to BSONElement in pipeline parsing.
Prevents use of rvalues among other annoying issues.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_project.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_project.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document_source_project.cpp b/src/mongo/db/pipeline/document_source_project.cpp index 916ea45d34e..1c274c1989a 100644 --- a/src/mongo/db/pipeline/document_source_project.cpp +++ b/src/mongo/db/pipeline/document_source_project.cpp @@ -99,13 +99,13 @@ namespace mongo { } intrusive_ptr<DocumentSource> DocumentSourceProject::createFromBson( - BSONElement *pBsonElement, + BSONElement elem, const intrusive_ptr<ExpressionContext> &pExpCtx) { /* validate */ uassert(15969, str::stream() << projectName << " specification must be an object", - pBsonElement->type() == Object); + elem.type() == Object); Expression::ObjectCtx objectCtx( Expression::ObjectCtx::DOCUMENT_OK @@ -113,14 +113,14 @@ namespace mongo { | Expression::ObjectCtx::INCLUSION_OK ); - intrusive_ptr<Expression> parsed = Expression::parseObject(pBsonElement, &objectCtx); + intrusive_ptr<Expression> parsed = Expression::parseObject(elem.Obj(), &objectCtx); ExpressionObject* exprObj = dynamic_cast<ExpressionObject*>(parsed.get()); massert(16402, "parseObject() returned wrong type of Expression", exprObj); uassert(16403, "$projection requires at least one output field", exprObj->getFieldCount()); intrusive_ptr<DocumentSourceProject> pProject(new DocumentSourceProject(pExpCtx, exprObj)); - BSONObj projectObj = pBsonElement->Obj(); + BSONObj projectObj = elem.Obj(); pProject->_raw = projectObj.getOwned(); // probably not necessary, but better to be safe #if defined(_DEBUG) |