diff options
author | Benety Goh <benety@mongodb.com> | 2014-02-06 11:52:13 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-02-07 13:16:44 -0500 |
commit | e01492875083bf30bba35b38a8a0301e66c422df (patch) | |
tree | 4f2c1e31f96ce38c9f07fdd148db6aaa8e9abe16 /src/mongo/db/exec/projection_exec.cpp | |
parent | 795353195c696a95a6f18a4deb38dfb5ad588ab9 (diff) | |
download | mongo-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.cpp | 8 |
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) { |