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

INLJ can output the same record twice when value is present by itself and in an array

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc5, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v6.0
    • QE 2022-05-16

      Script:

      (function () {
      'use strict';
      const collName = "fuzzer_coll";
      const aggregationList = [
      {"$lookup":{ "from": collName, "localField": "foo", "foreignField": "bar", "as": "array" }}];
      const documentList = [{ "_id" : 49, "foo": [1, [1]], "bar": 1, }];
      
      const coll = db[collName];
      coll.drop();
      assert.commandWorked(coll.insert(documentList));
      const indexList = [\{bar: 1}];
      assert.commandWorked(coll.createIndexes(indexList));
      
      assert.commandWorked(db.adminCommand({setParameter: 1, internalQuerySlotBasedExecutionDisableLookupPushdown: false}));
      const sberes = coll.aggregate(aggregationList).toArray();
      jsTestLog("123123 sbe result " + tojson(sberes));
      
      assert.commandWorked(db.adminCommand({setParameter: 1, internalQuerySlotBasedExecutionDisableLookupPushdown: true}));
      const classicres = coll.aggregate(aggregationList).toArray();
      jsTestLog("123123 classic result " + tojson(classicres));
      assert.commandWorked(db.adminCommand({setParameter: 1, internalQuerySlotBasedExecutionDisableLookupPushdown: false}));
      
      assert.eq(sberes, classicres);
      })();

      Output:

      [[
           {
               "_id" : 49,
               "foo" : [
                   1,
                   [
                       1
                   ]
               ],
               "bar" : 1,
               "array" : [
                   {
                       "_id" : 49,
                       "foo" : [
                           1,
                           [
                               1
                           ]
                       ],
                       "bar" : 1
                   },
                   {
                       "_id" : 49,
                       "foo" : [
                           1,
                           [
                               1
                           ]
                       ],
                       "bar" : 1
                   }
               ]
           }
       ]] != [[
           {
               "_id" : 49,
               "foo" : [
                   1,
                   [
                       1
                   ]
               ],
               "bar" : 1,
               "array" : [
                   {
                       "_id" : 49,
                       "foo" : [
                           1,
                           [
                               1
                           ]
                       ],
                       "bar" : 1
                   }
               ]
           }
       ]] 

            Assignee:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Reporter:
            mihai.andrei@mongodb.com Mihai Andrei
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: