summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-05-13 15:01:35 -0400
committerDan Pasette <dan@mongodb.com>2014-05-15 20:12:21 -0400
commitc26b53eaf60fdaa1413285a0892b782b33a9cf03 (patch)
treea347cc1cad66486c254361f5e974142c599035e9
parent3fa0ec160da4a0858faf63f1d7ce600254594b37 (diff)
downloadmongo-c26b53eaf60fdaa1413285a0892b782b33a9cf03.tar.gz
SERVER-13337 lite parsed query should set _showDiskLoc
(cherry picked from commit b0c0f83c4ca843412c991db3b21262be8ea78970)
-rw-r--r--jstests/core/showdiskloc.js5
-rw-r--r--src/mongo/db/query/lite_parsed_query.cpp2
2 files changed, 7 insertions, 0 deletions
diff --git a/jstests/core/showdiskloc.js b/jstests/core/showdiskloc.js
index d1339c6d238..a5bcd87bbdd 100644
--- a/jstests/core/showdiskloc.js
+++ b/jstests/core/showdiskloc.js
@@ -23,3 +23,8 @@ checkResults( t.find().batchSize( 2 )._addSpecial("$showDiskLoc" , true).toArray
t.ensureIndex( { a:1 } );
checkResults
( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } )._addSpecial("$showDiskLoc" , true).toArray() );
+
+// Check with an idhack query.
+t.drop();
+t.save({_id: 0, a: 1});
+checkResults( t.find( { _id: 0 } )._addSpecial("$showDiskLoc", true).toArray() );
diff --git a/src/mongo/db/query/lite_parsed_query.cpp b/src/mongo/db/query/lite_parsed_query.cpp
index 3635f3b442a..600973f1af6 100644
--- a/src/mongo/db/query/lite_parsed_query.cpp
+++ b/src/mongo/db/query/lite_parsed_query.cpp
@@ -399,6 +399,8 @@ namespace mongo {
else if (str::equals("showDiskLoc", name)) {
// Won't throw.
if (e.trueValue()) {
+ _showDiskLoc = true;
+
BSONObjBuilder projBob;
projBob.appendElements(_proj);
BSONObj metaDiskLoc = BSON("$diskLoc" <<