summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/projection_exec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/projection_exec.cpp')
-rw-r--r--src/mongo/db/exec/projection_exec.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/exec/projection_exec.cpp b/src/mongo/db/exec/projection_exec.cpp
index afa60132631..27eed3f90d4 100644
--- a/src/mongo/db/exec/projection_exec.cpp
+++ b/src/mongo/db/exec/projection_exec.cpp
@@ -347,8 +347,16 @@ namespace mongo {
}
Status ProjectionExec::transform(const BSONObj& in, BSONObj* out) const {
+ // If it's a positional projection we need a MatchDetails.
+ MatchDetails matchDetails;
+ if (transformRequiresDetails()) {
+ matchDetails.requestElemMatchKey();
+ verify(NULL != _queryExpression);
+ verify(_queryExpression->matchesBSON(in, &matchDetails));
+ }
+
BSONObjBuilder bob;
- Status s = transform(in, &bob, NULL);
+ Status s = transform(in, &bob, &matchDetails);
if (!s.isOK()) {
return s;
}