Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1847

HexData doesn't throw an error for incorrect arguments

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

      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 Unassigned
            Reporter:
            flibustier7seas@gmail.com flibustier seas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: