Fix $search $unionWith with explain

XMLWordPrintableJSON

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

      $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
              Reporter:
              Erin Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: