Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6148

aggregation $ne expression applied to constant returns incorrect result

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

      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 Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: