0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

fix test and clean code

This commit is contained in:
Eliot Horowitz 2009-08-10 21:04:13 -04:00
parent d2dc0575e0
commit 386aa02cce
2 changed files with 5 additions and 11 deletions

View File

@ -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<double>::max() ) ).firstElement();
}
else if ( upper_.isNumber() && lower_.type() == MinKey ){
lower_ = addObj( BSON( upper_.fieldName() << - numeric_limits<double>::max() ) ).firstElement();
}
*/
}

View File

@ -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" );