ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • Hide
      db.adminCommand({ setParameter: 1, internalQueryPlanRanker: "costBased"})
      db.a.drop()
      db.a.createIndex({"a.b":1, "a.c": 1})
      db.a.insertOne({a: [{b: 0, c: 1}, {b:1, c: 0}]})
      db.a.explain("executionStats").find({a: {$elemMatch: {b:1, c: 1}}}).finish().executionStats.executionStages.inputStage
      

      Gives:

        cardinalityEstimate: 1,
        estimatesMetadata: { ceSource: 'Code' },
        numKeysEstimate: 1,
        nReturned: 0,
        keysExamined: 0,
      
      Show
      db.adminCommand({ setParameter: 1, internalQueryPlanRanker: "costBased" }) db.a.drop() db.a.createIndex({ "a.b" :1, "a.c" : 1}) db.a.insertOne({a: [{b: 0, c: 1}, {b:1, c: 0}]}) db.a.explain( "executionStats" ).find({a: {$elemMatch: {b:1, c: 1}}}).finish().executionStats.executionStages.inputStage Gives: cardinalityEstimate: 1, estimatesMetadata: { ceSource: 'Code' }, numKeysEstimate: 1, nReturned: 0, keysExamined: 0,
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-98371 introduced the MultiKeyDottedPathIterator, which iterates the nested fields in the shape of a multikey index independently of one another, losing the coherence required for $elemMatch.

      Found by 6.1 Sol.

            Assignee:
            Unassigned
            Reporter:
            Kartal Kaan Bozdogan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: