summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_cursor.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2019-10-10 19:24:59 +0000
committerevergreen <evergreen@mongodb.com>2019-10-10 19:24:59 +0000
commitcfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db (patch)
treed2ebef38763cc0a9d079c1f28847a3d7be28bd6f /src/mongo/db/pipeline/document_source_cursor.cpp
parenta5a158b4d78feabca56b27313c017160b9851cb7 (diff)
downloadmongo-cfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db.tar.gz
SERVER-42560 Simplify passing of metadata between DocumentSource and PlanStage
Diffstat (limited to 'src/mongo/db/pipeline/document_source_cursor.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index eb01db2a2ad..e1193e33cb8 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -73,13 +73,6 @@ DocumentSource::GetNextResult DocumentSourceCursor::doGetNext() {
return std::move(out);
}
-Document DocumentSourceCursor::transformBSONObjToDocument(const BSONObj& obj) const {
- // Aggregation assumes ownership of underlying BSON.
- return _dependencies ? _dependencies->extractFields(obj)
- : (_inputHasMetadata ? Document::fromBsonWithMetaData(obj.getOwned())
- : Document(obj.getOwned()));
-}
-
void DocumentSourceCursor::loadBatch() {
if (!_exec || _exec->isDisposed()) {
// No more documents.
@@ -92,7 +85,7 @@ void DocumentSourceCursor::loadBatch() {
}
PlanExecutor::ExecState state;
- BSONObj resultObj;
+ Document resultObj;
{
AutoGetCollectionForRead autoColl(pExpCtx->opCtx, _exec->nss());
uassertStatusOK(repl::ReplicationCoordinator::get(pExpCtx->opCtx)
@@ -108,7 +101,7 @@ void DocumentSourceCursor::loadBatch() {
if (_shouldProduceEmptyDocs) {
_currentBatch.push_back(Document());
} else {
- _currentBatch.push_back(transformBSONObjToDocument(resultObj));
+ _currentBatch.push_back(transformDoc(resultObj.getOwned()));
}
if (_limit) {
@@ -228,9 +221,6 @@ Value DocumentSourceCursor::serialize(boost::optional<ExplainOptions::Verbosity>
if (_limit)
out["limit"] = Value(_limit->getLimit());
- if (!_projection.isEmpty())
- out["fields"] = Value(_projection);
-
BSONObjBuilder explainStatsBuilder;
{