-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
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