File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -862,7 +862,8 @@ namespace mongo {
862862 while ( j.more () ) {
863863 processQueryField ( j.next (), optimize );
864864 }
865- }
865+ }
866+ return ;
866867 }
867868
868869 if ( strcmp ( e.fieldName (), " $where" ) == 0 ) {
Original file line number Diff line number Diff line change @@ -206,6 +206,26 @@ namespace QueryUtilTests {
206206 BSONObj o1_, o2_;
207207 };
208208
209+ class And : public Base {
210+ public:
211+ And () : _o1( BSON( " -" << 0 ) ), _o2( BSON( " -" << 10 ) ) {}
212+ void run () {
213+ Base::run ();
214+ const FieldRangeSet s ( " ns" , query (), true );
215+ // There should not be an index constraint recorded for the $and field.
216+ ASSERT ( s.range ( " $and" ).universal () );
217+ }
218+ private:
219+ virtual BSONObj query () {
220+ return BSON ( " $and" <<
221+ BSON_ARRAY ( BSON ( " a" << GT << 0 ) << BSON ( " a" << LTE << 10 ) ) );
222+ }
223+ virtual BSONElement lower () { return _o1.firstElement (); }
224+ virtual bool lowerInclusive () { return false ; }
225+ virtual BSONElement upper () { return _o2.firstElement (); }
226+ BSONObj _o1, _o2;
227+ };
228+
209229 class Empty {
210230 public:
211231 void run () {
@@ -1079,6 +1099,7 @@ namespace QueryUtilTests {
10791099 add< FieldRangeTests::RegexObj >();
10801100 add< FieldRangeTests::UnhelpfulRegex >();
10811101 add< FieldRangeTests::In >();
1102+ add< FieldRangeTests::And >();
10821103 add< FieldRangeTests::Empty >();
10831104 add< FieldRangeTests::Equality >();
10841105 add< FieldRangeTests::SimplifiedQuery >();
You can’t perform that action at this time.
0 commit comments