Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-11528

Docs for SERVER-33757: Treat an illegal target type in $convert as an "onError" case

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.4
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Documentation Request Summary:

      This ticket describes a minor change to how $convert handles "to" values that it doesn't support for conversion.

      Engineering Ticket Description:

      Currently, an illegal target type (e.g., "minKey") results in a query failure, even if there is an "onError" value. This means that attempting to pass the return value of a $type expression as the "to" parameter can result in a failure.

      With this change, an invalid target type will instead return the "onError" value when it is present. Note that a string or number that does not map to any type will still result in an error in all cases.

       

      Scope of changes:

      None – we already doc (https://docs.mongodb.com/master/reference/operator/aggregation/convert/#exp._S_convert) for ``onError`` field description:

      Optional. The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression.

      If unspecified, the operation throws an error upon encountering an error and stops.

      Impact to other docs outside of this product:

      MVP:

      Resources:

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              6 years, 3 weeks, 3 days ago