|
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.
|