diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2014-03-20 14:57:34 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2014-03-21 12:57:28 -0400 |
commit | a79c8cfc2f3d778c9aa11d782b76adeec4624b37 (patch) | |
tree | 2af73c492bf8eb2147ac9faebc6c674c1088d40a /src/mongo/db/exec/projection_exec.cpp | |
parent | 3792e501d812a51b796cc670aaf3e3b8c2439682 (diff) | |
download | mongo-a79c8cfc2f3d778c9aa11d782b76adeec4624b37.tar.gz |
SERVER-13292 fast path simple/fully covered projections
Diffstat (limited to 'src/mongo/db/exec/projection_exec.cpp')
-rw-r--r-- | src/mongo/db/exec/projection_exec.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/mongo/db/exec/projection_exec.cpp b/src/mongo/db/exec/projection_exec.cpp index 15a224cbe72..afa60132631 100644 --- a/src/mongo/db/exec/projection_exec.cpp +++ b/src/mongo/db/exec/projection_exec.cpp @@ -249,7 +249,23 @@ namespace mongo { } BSONObjBuilder bob; - if (!requiresDocument()) { + if (member->hasObj()) { + MatchDetails matchDetails; + + // If it's a positional projection we need a MatchDetails. + if (transformRequiresDetails()) { + matchDetails.requestElemMatchKey(); + verify(NULL != _queryExpression); + verify(_queryExpression->matchesBSON(member->obj, &matchDetails)); + } + + Status projStatus = transform(member->obj, &bob, &matchDetails); + if (!projStatus.isOK()) { + return projStatus; + } + } + else { + verify(!requiresDocument()); // Go field by field. if (_includeID) { BSONElement elt; @@ -273,24 +289,6 @@ namespace mongo { } } } - else { - // Planner should have done this. - verify(member->hasObj()); - - MatchDetails matchDetails; - - // If it's a positional projection we need a MatchDetails. - if (transformRequiresDetails()) { - matchDetails.requestElemMatchKey(); - verify(NULL != _queryExpression); - verify(_queryExpression->matchesBSON(member->obj, &matchDetails)); - } - - Status projStatus = transform(member->obj, &bob, &matchDetails); - if (!projStatus.isOK()) { - return projStatus; - } - } for (MetaMap::const_iterator it = _meta.begin(); it != _meta.end(); ++it) { if (META_GEONEAR_DIST == it->second) { |