@@ -40,13 +40,8 @@ export class ObjectId extends BSONValue {
4040 /** ObjectId Bytes @internal */
4141 private buffer ! : Uint8Array ;
4242
43- /**
44- * Create ObjectId from a number.
45- *
46- * @param inputId - A number.
47- * @deprecated Instead, use `static createFromTime()` to set a numeric value for the new ObjectId.
48- */
49- constructor ( inputId : number ) ;
43+ /** To generate a new ObjectId, use ObjectId() with no argument. */
44+ constructor ( ) ;
5045 /**
5146 * Create ObjectId from a 24 character hex string.
5247 *
@@ -71,20 +66,18 @@ export class ObjectId extends BSONValue {
7166 * @param inputId - A 12 byte binary Buffer.
7267 */
7368 constructor ( inputId : Uint8Array ) ;
74- /** To generate a new ObjectId, use ObjectId() with no argument. */
75- constructor ( ) ;
7669 /**
7770 * Implementation overload.
7871 *
7972 * @param inputId - All input types that are used in the constructor implementation.
8073 */
81- constructor ( inputId ?: string | number | ObjectId | ObjectIdLike | Uint8Array ) ;
74+ constructor ( inputId ?: string | ObjectId | ObjectIdLike | Uint8Array ) ;
8275 /**
8376 * Create a new ObjectId.
8477 *
8578 * @param inputId - An input value to create a new ObjectId from.
8679 */
87- constructor ( inputId ?: string | number | ObjectId | ObjectIdLike | Uint8Array ) {
80+ constructor ( inputId ?: string | ObjectId | ObjectIdLike | Uint8Array ) {
8881 super ( ) ;
8982 // workingId is set based on type of input and whether valid id exists for the input
9083 let workingId ;
@@ -102,12 +95,12 @@ export class ObjectId extends BSONValue {
10295 }
10396
10497 // The following cases use workingId to construct an ObjectId
105- if ( workingId == null || typeof workingId === 'number' ) {
98+ if ( workingId == null ) {
10699 // The most common use case (blank id, new objectId instance)
107100 // Generate a new id
108- this . buffer = ObjectId . generate ( typeof workingId === 'number' ? workingId : undefined ) ;
101+ this . buffer = ObjectId . generate ( ) ;
109102 } else if ( ArrayBuffer . isView ( workingId ) && workingId . byteLength === 12 ) {
110- // If intstanceof matches we can escape calling ensure buffer in Node.js environments
103+ // If instanceof matches we can escape calling ensure buffer in Node.js environments
111104 this . buffer = ByteUtils . toLocalBufferType ( workingId ) ;
112105 } else if ( typeof workingId === 'string' ) {
113106 if ( ObjectId . validateHexString ( workingId ) ) {
@@ -349,7 +342,7 @@ export class ObjectId extends BSONValue {
349342 * Checks if a value can be used to create a valid bson ObjectId
350343 * @param id - any JS value
351344 */
352- static isValid ( id : string | number | ObjectId | ObjectIdLike | Uint8Array ) : boolean {
345+ static isValid ( id : string | ObjectId | ObjectIdLike | Uint8Array ) : boolean {
353346 if ( id == null ) return false ;
354347 if ( typeof id === 'string' ) return ObjectId . validateHexString ( id ) ;
355348
0 commit comments