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

Weird shapification behavior for $convert/$toString

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

      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@mongodb.com Mariano Shaar
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: