aggregation $ne expression applied to constant returns incorrect result

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      ExpressionCompare::optimize() generates an ExpressionFieldRange for a $ne comparison against a constant. However ExpressionFieldRange does not properly encapsulate the semantics of not equals matching.

      Test:

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

            Assignee:
            Unassigned
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: