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

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

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

      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@mongodb.com David Storch
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: