From 386aa02cce9b0d47cf1dfd932530234fe8f689a7 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 10 Aug 2009 21:04:13 -0400 Subject: [PATCH] fix test and clean code --- db/queryutil.cpp | 10 +--------- jstests/hint1.js | 6 ++++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/db/queryutil.cpp b/db/queryutil.cpp index 60b5b124401..c7fa6fb4ba7 100644 --- a/db/queryutil.cpp +++ b/db/queryutil.cpp @@ -85,7 +85,7 @@ namespace mongo { default: break; } - + if ( lower_.type() != MinKey && upper_.type() == MaxKey ){ BSONObjBuilder b; b.appendMaxForType( lower_.fieldName() , lower_.type() ); @@ -97,14 +97,6 @@ namespace mongo { lower_ = addObj( b.obj() ).firstElement(); } - /* - if ( lower_.isNumber() && upper_.type() == MaxKey ){ - upper_ = addObj( BSON( lower_.fieldName() << numeric_limits::max() ) ).firstElement(); - } - else if ( upper_.isNumber() && lower_.type() == MinKey ){ - lower_ = addObj( BSON( upper_.fieldName() << - numeric_limits::max() ) ).firstElement(); - } - */ } diff --git a/jstests/hint1.js b/jstests/hint1.js index 999f4f49597..416eb4a13ae 100644 --- a/jstests/hint1.js +++ b/jstests/hint1.js @@ -1,8 +1,10 @@ + p = db.jstests_hint1; +p.drop(); p.save( { ts: new Date( 1 ), cls: "entry", verticals: "alleyinsider", live: true } ); p.ensureIndex( { ts: 1 } ); e = p.find( { live: true, ts: { $lt: new Date( 1234119308272 ) }, cls: "entry", verticals: " alleyinsider" } ).sort( { ts: -1 } ).hint( { ts: 1 } ).explain(); -assert.eq( e.startKey.ts.getTime(), new Date( 1234119308272 ).getTime() ); -assert.eq( 1, e.endKey.ts.$minElement ); +assert.eq( e.startKey.ts.getTime(), new Date( 1234119308272 ).getTime() , "A" ); +assert.eq( 0 , e.endKey.ts.getTime() , "B" );