0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

If index direction is not numeric, assume forward; fixes 1101

This commit is contained in:
Aaron 2008-12-10 10:46:57 -05:00
parent 4c027f3cad
commit 2cf251148e

View File

@ -65,7 +65,10 @@ void BtreeCursor::findExtremeKeys( const BSONObj &query ) {
for( set<string>::iterator i = fields.begin(); i != fields.end(); ++i ) {
const char * field = i->c_str();
BSONElement k = indexDetails.keyPattern().getFieldDotted( field );
bool forward = ( ( k.number() > 0 ? 1 : -1 ) * direction > 0 );
int number = 1;
if( k.type() == NumberDouble || k.type() == NumberInt )
number = k.number();
bool forward = ( ( number > 0 ? 1 : -1 ) * direction > 0 );
BSONElement startElement;
BSONElement endElement;
BSONElement e = query.getFieldDotted( field );