[SERVER-6142] ExpressionCompare::evaluate does not use Value::compare, does not handle heterogenous types (including numeric types) and some other comparison cases Created: 20/Jun/12  Updated: 11/Jul/16  Resolved: 27/Jul/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.2.0-rc1

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

Issue Links:
Duplicate
is duplicated by SERVER-6283 aggregate $cmp cannot be used with va... Closed
Related
is related to SERVER-6206 need a policy for incompatible types ... Closed
Participants:

 Description   

ExpressionCompare::evaluate cannot compare different types (including numeric types) and cannot compare some types at all (eg objects). Lacks some functionality of Value::compare.

Test

c = db.c;
c.drop();
 
c.save( { a:1, b:NumberLong(1) } );
c.save( { a:NumberLong(1), b:NumberLong(1) } );
c.save( { a:{q:1}, b:{q:1} } );
printjson( c.aggregate( { $project:{ z:{ $eq:[ '$a', '$b' ] } } } ) );

There are also some todo comments:

        /* TODO look into collapsing by using Value::compare() */

        // CW TODO at least for now.  later, handle automatic conversions

Observed behavior: An assertion occurs when an attempt is made to compare numbers of different numeric types with an aggregation expression.
Expected behavior: Different numeric types can be compared.



 Comments   
Comment by auto [ 27/Jul/12 ]

Author:

{u'date': u'2012-07-23T15:02:32-07:00', u'email': u'dannenberg.matt@gmail.com', u'name': u'Matt Dannenberg'}

Message: SERVER-6142 make compares in aggro consistent

ExpressionCompare now uses Value::compare
Branch: master
https://github.com/mongodb/mongo/commit/859c7268aebb0dcd6ce0f67e717bf5a5373dbf3f

Generated at Thu Feb 08 03:10:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.