summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/projection_exec.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2014-03-20 14:57:34 -0400
committerHari Khalsa <hkhalsa@10gen.com>2014-03-21 12:57:28 -0400
commita79c8cfc2f3d778c9aa11d782b76adeec4624b37 (patch)
tree2af73c492bf8eb2147ac9faebc6c674c1088d40a /src/mongo/db/exec/projection_exec.cpp
parent3792e501d812a51b796cc670aaf3e3b8c2439682 (diff)
downloadmongo-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.cpp36
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) {