Inclusion projection scenario that falsely writes included field to document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 4.0.10, 4.3.1
    • Component/s: Aggregation Framework
    • ALL
    • Hide
      db.coll.drop();
      db.coll.insert({});
      db.coll.createIndex({"str": 1});
      
      var result =
          db.coll.aggregate([{$match: {'str': {$not: {$eq: ''}}}},
                                               {$project: {"str": 1, "_id": 0}}]).toArray();
      assert.eq({}, result[0]);
      
      Show
      db.coll.drop(); db.coll.insert({}); db.coll.createIndex({ "str" : 1}); var result = db.coll.aggregate([{$match: { 'str' : {$not: {$eq: ''}}}}, {$project: { "str" : 1, "_id" : 0}}]).toArray(); assert .eq({}, result[0]);
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      In the reproduction below an aggregate with match and inclusion projection writes the included field to the output document. It should instead produce an empty document. This is consistently reproducible on 4.0.10 and occurs sporadically on master and 4.2.0-rc0.

      The assertion fails with the following error:

      assert: [{ }] != [{ "str" : null }] are not equal
      

            Assignee:
            James Wahlin
            Reporter:
            James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: