Weird shapification behavior for $convert/$toString

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 7.2.1, 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • ALL
    • v7.2
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I noticed this while reviewing the pull request for SERVER-74371 "Support arbitrary expressions for 'field' parameter for $getField" - a test case there shows the following:

      Current Behavior

      {$toString: "$foo"}
      

      will become one of the following, depending on the serialization options:

      Representative Shape
      {$convert: {
          input: "$foo",
          to: "?"
      }}
      
      Debug Shape
      {$convert: {
          input: "$foo",
          to: "?string"
      }}
      

      Proposed New Behavior

      I would propose we do the following instead:

      Representative Shape
      {$convert: {
          input: "$foo",
          to: "string"
      }}
      
      Debug Shape
      {$convert: {
          input: "$foo",
          to: "string"
      }}
      

              Assignee:
              Mariano Shaar
              Reporter:
              Charlie Swanson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: