ExportXMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... Node.js user/mongosh/compass developer
      I want... to render Binary objects in a more brief way in shell/compass
      So that... it's bit easier to type manually, less to copy, fits on a smaller screen real estate

      User Experience

      • Binary objects render with the smaller proposed helper and it is runnable code in Node driver and mongosh environments
      // today
      Binary.createFromBase64('WFsJfpNmeoU1JfCvOrtbc64erAs=', 0),
      // after this work
      Binary.b64('WFsJfpNmeoU1JfCvOrtbc64erAs=', 0),
      

      Dependencies

      • None

      Risks/Unknowns

      • Binary will need to support the current method and the new alias probably indefinitely, but maybe after a few majors the longer form could be dropped.

      Acceptance Criteria

      Implementation Requirements

      • Add a static method "b64" to the Binary class that takes a string and sub_type and calls createFromBase64
      • Update the Binary's inspect hook to use this new briefer method
      Optional

      The following can be considered to make for a consistent and unsurprising user experience but is not strictly required

      • Add a brief static "hex" method to call createFromHex
      • Add both brief methods to ObjectId
        • ObjectId has mirrored createFromBase64 createFromHex to make for a consistent creation experience of the two most popular primary key types

      Testing Requirements

      • Ensure the new brief methods invoke the longer forms and pass the arguments and return the results as expected
      • Ensure UUID.b64 and UUID.hex return UUID instances
        • This will need to be fixed, but is not a breaking change

      Documentation Requirements

      • API docs

      Follow Up Requirements

      • Ensure devtools changes is checked when this closes

            Assignee:
            Unassigned
            Reporter:
            Neal Beeken
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: