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

Fix $search $unionWith with explain

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • ALL

      $unionWIth $search explain errors out when using $search and $$SEARCH_META in the subpipeline since SEARCH_META is used in the original run of the pipeline which seems to add it in the let variables. Then when $unionWith reruns the pipeline for explain, it errors due to SEARCH_META not being allowed to be in the letVariables.

      pipeline: [{
          $unionWith: {
              coll: searchColl.getName(),
              pipeline: [
                  {$search: mongotQuery},
                  {
                      $project: {
                          "_id": 0,
                          "ref_id": "$_id",
                          "title": "$title",
                          "searchMeta": "$$SEARCH_META",
                      }
                  }
              ]
          }
      }]
      

      A possible solution is to clear SEARCH_META from the let variables.

            Assignee:
            erin.zhu@mongodb.com Erin Zhu
            Reporter:
            erin.zhu@mongodb.com Erin Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: