From fc75cfdf2e8f97572efd97a348893ba08a82276a Mon Sep 17 00:00:00 2001 From: yarai Date: Wed, 12 Sep 2018 14:43:56 -0400 Subject: SERVER-36931 Handle returnKey option for $** indexes --- src/mongo/db/exec/index_scan.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mongo/db/exec/index_scan.cpp') diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index 45f45da73f4..a4836e6e5a2 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -38,6 +38,7 @@ #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/index_access_method.h" +#include "mongo/db/index_names.h" #include "mongo/db/query/index_bounds_builder.h" #include "mongo/stdx/memory.h" #include "mongo/util/log.h" @@ -218,9 +219,8 @@ PlanStage::StageState IndexScan::doWork(WorkingSetID* out) { _workingSet->transitionToRecordIdAndIdx(id); if (_params.addKeyMetadata) { - BSONObjBuilder bob; - bob.appendKeys(_keyPattern, kv->key); - member->addComputed(new IndexKeyComputedData(bob.obj())); + member->addComputed( + new IndexKeyComputedData(IndexKeyComputedData::rehydrateKey(_keyPattern, kv->key))); } *out = id; -- cgit v1.2.1