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

Stabilise query shape hash for aggregate merge commands with let variables

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.4
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0
    • QE 2024-09-02, QE 2024-09-16, QE 2024-09-30

      Repeatedly settings query settings on the following representative query shape will eventually result into two different entries due to divergent query shape hashes: 

      rs0 [direct: primary] test> showSettings()
      [
        {
          queryShapeHash: '995EB6C4BDA130072F8F444FA87CFE077A0D41425574A6BA83D52B89A450D6F6',
          settings: {
            indexHints: [
              {
                ns: { db: 'asd', coll: 'asd' },
                allowedIndexes: [ 'index97' ]
              }
            ]
          },
          representativeQuery: {
            aggregate: 'mode_pipeline_insert_source',
            '$db': 'test',
            cursor: {},
            pipeline: [
              {
                '$merge': {
                  let: { foo: 'bar' },
                  into: 'mode_pipeline_insert_target',
                  on: '_id',
                  whenMatched: [ { '$project': { x: '$$new.a', y: '$$new.b' } } ],
                  whenNotMatched: 'insert'
                }
              }
            ]
          }
        },
        {
          queryShapeHash: '909500D475C34413EC202AFFDD342D0252437BC4746E44D668AF8539A7184550',
          settings: {
            indexHints: [
              {
                ns: { db: 'asd', coll: 'asd' },
                allowedIndexes: [ 'index100' ]
              }
            ]
          },
          representativeQuery: {
            aggregate: 'mode_pipeline_insert_source',
            '$db': 'test',
            cursor: {},
            pipeline: [
              {
                '$merge': {
                  let: { foo: 'bar' },
                  into: 'mode_pipeline_insert_target',
                  on: '_id',
                  whenMatched: [ { '$project': { x: '$$new.a', y: '$$new.b' } } ],
                  whenNotMatched: 'insert'
                }
              }
            ]
          }
        }
      ] 

            Assignee:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Reporter:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: