-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
Use Case
As a BSON user
I want the ObjectId constructor to accept values that represent complete ObjectIds
So that I either generate a new Oid or build from an existing one
User Impact
- Using numbers in the ObjectId constructor will have a deprecated tag.
- In editors that support it, the API should appear as
new ObjectId(2)
- In editors that support it, the API should appear as
Dependencies
- The driver by re-exporting ObjectId should also make this documentation available to users
Unknowns
- None
Acceptance Criteria
Implementation Requirements
- Separate the current accepted ObjectId constructor input types into individual typescript overrides
- Mark the one that accepts number as deprecated
- Mention the preferred createFromTime helper
- Update isValid documentation to mention the deprecation
Testing Requirements
- Add a type test for the deprecation
Documentation Requirements
- Ensure change is merged as a feat and release notes capture the planned change
Follow Up Requirements
- has to be done before
-
NODE-5763 Remove number as an input to ObjectId constructor
- Backlog