HexData doesn't throw an error for incorrect arguments

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: snippets
    • None
    • Environment:
      OS: Linux
    • Not Needed
    • Developer Tools

      Problem Statement/Rationale

      Hi everyone,

      I'm encountering an issue with HexData where it doesn't throw an error when provided with incorrect arguments.

      Steps to Reproduce

      docker run -it --rm mongo:7.0.12 bash
      
      mongosh mongodb://host.docker.internal:27017/admin
      
      # ...
      # Using Mongosh:          2.2.10
      # ...
      
      HexData(3, "0001b8b3-fbb2-7f46-871a-bf33c282bcc0")
      
      # Binary.createFromBase64('AAG4sw==', 3)
      

      Expected Results

      HexData should throw an error like old mongo shell did it

      docker run -it --rm mongo:5 bash
       
      mongo mongodb://host.docker.internal:27017/admin
       
      HexData(3, "0001b8b3-fbb2-7f46-871a-bf33c282bcc0")
       
      # Error: The character \x2d failed to parse from hex. :
      # @(shell):1:1
      

      Actual Results

      HexData interprets only part of the second argument and produces an unexpected value.

      HexData(3, "0001b8b3-fbb2-7f46-871a-bf33c282bcc0")
      
      # Binary.createFromBase64('AAG4sw==', 3)
      

              Assignee:
              Unassigned
              Reporter:
              flibustier seas
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: