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:
parent
d2dc0575e0
commit
386aa02cce
@ -85,7 +85,7 @@ namespace mongo {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lower_.type() != MinKey && upper_.type() == MaxKey ){
|
if ( lower_.type() != MinKey && upper_.type() == MaxKey ){
|
||||||
BSONObjBuilder b;
|
BSONObjBuilder b;
|
||||||
b.appendMaxForType( lower_.fieldName() , lower_.type() );
|
b.appendMaxForType( lower_.fieldName() , lower_.type() );
|
||||||
@ -97,14 +97,6 @@ namespace mongo {
|
|||||||
lower_ = addObj( b.obj() ).firstElement();
|
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();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
p = db.jstests_hint1;
|
p = db.jstests_hint1;
|
||||||
|
p.drop();
|
||||||
|
|
||||||
p.save( { ts: new Date( 1 ), cls: "entry", verticals: "alleyinsider", live: true } );
|
p.save( { ts: new Date( 1 ), cls: "entry", verticals: "alleyinsider", live: true } );
|
||||||
p.ensureIndex( { ts: 1 } );
|
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();
|
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( e.startKey.ts.getTime(), new Date( 1234119308272 ).getTime() , "A" );
|
||||||
assert.eq( 1, e.endKey.ts.$minElement );
|
assert.eq( 0 , e.endKey.ts.getTime() , "B" );
|
||||||
|
Loading…
Reference in New Issue
Block a user