Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4361

Remove legacy string format support from BSON

    • 3
    • Not Needed
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Current behavior

      Currently BSON.Binary interprets strings as a raw sequence of bytes, as a ISO-8859-1 encoded sequence.

      > new BSON.Binary('[Sunglasses emoji]')
      new Binary(Buffer.from("3d0e", "hex"), 0)
      > new BSON.Binary(Buffer.from('[Sunglasses emoji]', 'utf8'))
      new Binary(Buffer.from("f09f988e", "hex"), 0)
      

      We should consider explicitly deprecating / removing this behavior as it's likely unexpected, and is a very legacy pattern for transferring binary data. ObjectId also accepts this format and it should be removed. ObjectId accepts UTF8 strings so similarly takes in an unexpected string format that should be removed.

      Acceptance Criteria

      Implementation

      • See subtasks

      Testing

      • Test new failure cases
      • Remove tests using legacy encoding

        There are no Sub-Tasks for this issue.

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: