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

Constrain new ObjectId constructor and drop support for non-relevant cases

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • 0
    • 0
    • 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?

      What problem are you facing?

      Right now the ObjectID constructor accepts parameters of the following types: string,  Buffer, number, ObjectIdLike, ObjectId. We could constrain the new constructor to specific types (it should definitely accept hex string, buffer, no args, and potentially ObjectID, but we could drop support for 12 byte strings and numbers) and add static ObjectId.from for the other cases. 
       

      Acceptance Criteria 

      • Fix the constructor to support specific types 
      • Add tests to ensure that constructor is handling unsupported cases appropriately

            Assignee:
            Unassigned Unassigned
            Reporter:
            grace.chong@mongodb.com Grace Chong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: