diff options
-rw-r--r-- | jstests/core/showdiskloc.js | 5 | ||||
-rw-r--r-- | src/mongo/db/query/lite_parsed_query.cpp | 2 |
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" << |