Skip to content

Commit

Permalink
SERVER-109 parse field ranges of or fields-
Browse files Browse the repository at this point in the history
  • Loading branch information
astaple committed May 10, 2010
1 parent b042060 commit 34a9c96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions db/queryutil.cpp
Expand Up @@ -507,6 +507,17 @@ namespace mongo {

if ( strcmp( e.fieldName(), "$where" ) == 0 )
continue;

if ( strcmp( e.fieldName(), "$or" ) == 0 ) {
massert( 13142, "$or requires nonempty array", e.type() == Array && e.embeddedObject().nFields() > 0 );
BSONObjIterator j( e.embeddedObject() );
while( j.more() ) {
BSONElement f = j.next();
massert( 13143, "$or array must contain objects", f.type() == Object );
_orSets.push_back( FieldRangeSet( ns, f.embeddedObject(), optimize ) );
}
continue;
}

bool equality = ( getGtLtOp( e ) == BSONObj::Equality );
if ( equality && e.type() == Object ) {
Expand Down
1 change: 1 addition & 0 deletions db/queryutil.h
Expand Up @@ -187,6 +187,7 @@ namespace mongo {
static FieldRange *trivialRange_;
static FieldRange &trivialRange();
mutable map< string, FieldRange > ranges_;
vector< FieldRangeSet > _orSets;
const char *ns_;
BSONObj query_;
};
Expand Down

0 comments on commit 34a9c96

Please sign in to comment.