summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/projection_exec.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-02-06 11:52:13 -0500
committerBenety Goh <benety@mongodb.com>2014-02-07 13:16:44 -0500
commite01492875083bf30bba35b38a8a0301e66c422df (patch)
tree4f2c1e31f96ce38c9f07fdd148db6aaa8e9abe16 /src/mongo/db/exec/projection_exec.cpp
parent795353195c696a95a6f18a4deb38dfb5ad588ab9 (diff)
downloadmongo-e01492875083bf30bba35b38a8a0301e66c422df.tar.gz
SERVER-12129 meta projection operator should overwrite fields
Diffstat (limited to 'src/mongo/db/exec/projection_exec.cpp')
-rw-r--r--src/mongo/db/exec/projection_exec.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/exec/projection_exec.cpp b/src/mongo/db/exec/projection_exec.cpp
index 05a33a24002..15a224cbe72 100644
--- a/src/mongo/db/exec/projection_exec.cpp
+++ b/src/mongo/db/exec/projection_exec.cpp
@@ -479,6 +479,14 @@ namespace mongo {
const MatchDetails* details,
const ArrayOpType arrayOpType) const {
+
+ // Skip if the field name matches a computed $meta field.
+ // $meta projection fields can exist at the top level of
+ // the result document and the field names cannot be dotted.
+ if (_meta.find(elt.fieldName()) != _meta.end()) {
+ return Status::OK();
+ }
+
FieldMap::const_iterator field = _fields.find(elt.fieldName());
if (field == _fields.end()) {
if (_include) {