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

Sharded view resolution in $lookup incorrectly updates index of match stage

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • QO 2021-09-06
    • 157

      In sharded $lookup, when the from field of the $lookup is a sharded view and a CommandOnShardedViewNotSupported exception is generated to resolve the pipeline for this view, it is necessary to update the index of the match stage for the field join (_fieldMatchPipelineIdx) to the correct value.

      The initial implementation incorrectly assumed that this stage would always be the last one in the pipeline. The solution is to update the old index of the match stage by adding the length of the view pipeline to it.

            Assignee:
            alya.berciu@mongodb.com Alya Berciu
            Reporter:
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: