explain command for a find with $expr and let parameters fails if the collection is sharded

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.0.0-rc0, 7.1.0-rc0, 6.0.6
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v7.0, v6.3, v6.0, v5.0
    • QE 2023-04-17
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      For an unsharded collection, the following explain command runs successfully.

      {
              explain: {find: collName, filter: {$expr: {$eq: ["$x", "$$var"]}}, let : {var : 1}}
      } 

      However, for a sharded collection, it fails with the following error:

      {"ok" : 0, "errmsg" : "Use of undefined variable: var", "code" : 17276, "codeName" : "Location17276"}
      

      The behavior is the same on the 6.0 branch.

              Assignee:
              David Storch
              Reporter:
              Cheahuychou Mao
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: