[COMPASS-6258] Investigate changes in NODE-4770: Remove UTF8 length 12 strings from ObjectId constructor Created: 26/Oct/22  Updated: 01/Feb/23  Resolved: 01/Feb/23

Status: Closed
Project: Compass
Component/s: None
Affects Version/s: None
Fix Version/s: No version

Type: Investigation Priority: Major - P3
Reporter: PM Bot Assignee: Unassigned
Resolution: Done Votes: 0
Labels: node-driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on NODE-4770 Remove UTF8 length 12 strings from Ob... Closed
Documentation Changes: Not Needed

 Description   

Details

As of v4.2.0 ObjectId's began interpreting strings of length 12 as UTF8 instead of latin1. We should remove support for strings that aren't exactly hex strings to make construction from string input clear and lack a variation of interpretations.

AC

  • Only allow strings of length 24 that contain hex characters
  • Remove strings of length 12 from objectId constructor
  • Update tests


 Comments   
Comment by Maurizio Casimirri [ 01/Feb/23 ]

Should be part of the documentation of Mongosh v2

Generated at Wed Feb 07 22:42:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.