[SERVER-653] Current usage of embedded matcher fails when operator is not first element Created: 22/Feb/10  Updated: 12/Jul/16  Resolved: 23/Feb/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 1.3.3

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

This doesn't work right now

assert.eq( 1, t.find( { a:

{ $gt: 5, $mod : [ 10, 1 ] }

} ).itcount() );

because $mod isn't the first element.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 23/Feb/10 ]

i think you finished, but wasn't 100% sure
so just resolve if you did

Comment by Eliot Horowitz (Inactive) [ 23/Feb/10 ]

no, don't think we need to backport this

Comment by Aaron Staple [ 22/Feb/10 ]

Eliot do you want to backport?

Comment by Aaron Staple [ 22/Feb/10 ]

BasicMatcher( BSONElement _e , int _op ) : toMatch( _e ) , compareOp( _op ){
if ( _op == BSONObj::opMOD )

{ BSONObj o = _e.embeddedObject().firstElement().embeddedObject(); mod = o["0"].numberInt(); modm = o["1"].numberInt(); uassert( "mod can't be 0" , mod ); }

else if ( _op == BSONObj::opTYPE )

{ type = (BSONType)(_e.embeddedObject().firstElement().numberInt()); }

}

Comment by Aaron Staple [ 22/Feb/10 ]

Sorry, it looks like it is a problem in 1.2:

case BSONObj::opMOD:
case BSONObj::opTYPE:
basics.push_back( BasicMatcher( e , op ) );
break;

Comment by Aaron Staple [ 22/Feb/10 ]

Looks like this isn't in 1.2, so we don't have to backport.

Comment by auto [ 22/Feb/10 ]

Author:

{'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}

Message: SERVER-653 fix problem where some special query types would only work if they were the first element
http://github.com/mongodb/mongo/commit/079031215d946eb118f6228a36eb04dc53b9dac4

Generated at Thu Feb 08 02:54:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.