@@ -44,9 +44,48 @@ export class ObjectId extends BSONValue {
44
44
private __id ?: string ;
45
45
46
46
/**
47
- * Create an ObjectId type
47
+ * Create ObjectId from a number.
48
48
*
49
- * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
49
+ * @param inputId - A number.
50
+ * @deprecated Instead, use `static createFromTime()` to set a numeric value for the new ObjectId.
51
+ */
52
+ constructor ( inputId : number ) ;
53
+ /**
54
+ * Create ObjectId from a 24 character hex string.
55
+ *
56
+ * @param inputId - A 24 character hex string.
57
+ */
58
+ constructor ( inputId : string ) ;
59
+ /**
60
+ * Create ObjectId from the BSON ObjectId type.
61
+ *
62
+ * @param inputId - The BSON ObjectId type.
63
+ */
64
+ constructor ( inputId : ObjectId ) ;
65
+ /**
66
+ * Create ObjectId from the object type that has the toHexString method.
67
+ *
68
+ * @param inputId - The ObjectIdLike type.
69
+ */
70
+ constructor ( inputId : ObjectIdLike ) ;
71
+ /**
72
+ * Create ObjectId from a 12 byte binary Buffer.
73
+ *
74
+ * @param inputId - A 12 byte binary Buffer.
75
+ */
76
+ constructor ( inputId : Uint8Array ) ;
77
+ /** To generate a new ObjectId, use ObjectId() with no argument. */
78
+ constructor ( ) ;
79
+ /**
80
+ * Implementation overload.
81
+ *
82
+ * @param inputId - All input types that are used in the constructor implementation.
83
+ */
84
+ constructor ( inputId ?: string | number | ObjectId | ObjectIdLike | Uint8Array ) ;
85
+ /**
86
+ * Create a new ObjectId.
87
+ *
88
+ * @param inputId - An input value to create a new ObjectId from.
50
89
*/
51
90
constructor ( inputId ?: string | number | ObjectId | ObjectIdLike | Uint8Array ) {
52
91
super ( ) ;
@@ -65,7 +104,7 @@ export class ObjectId extends BSONValue {
65
104
workingId = inputId ;
66
105
}
67
106
68
- // the following cases use workingId to construct an ObjectId
107
+ // The following cases use workingId to construct an ObjectId
69
108
if ( workingId == null || typeof workingId === 'number' ) {
70
109
// The most common use case (blank id, new objectId instance)
71
110
// Generate a new id
0 commit comments