To generate a new ObjectId, use ObjectId() with no argument.
Create ObjectId from a 24 character hex string.
A 24 character hex string.
Create ObjectId from the object type that has the toHexString method.
The ObjectIdLike type.
Create ObjectId from a 12 byte binary Buffer.
A 12 byte binary Buffer.
The ObjectId bytes
Compares the equality of this ObjectId with otherID.
ObjectId instance to compare against.
Returns the generation date (accurate up to the second) that this ID was generated.
Converts to a string representation of this Id.
Optionaldepth: numberOptionaloptions: unknownOptionalinspect: InspectFnreturn the 24 character hex string representation.
Returns the ObjectId id as a 24 lowercase character hex string representation
Converts to its JSON the 24 character hex string representation.
Converts the id into a 24 character hex string for printing, unless encoding is provided.
Optionalencoding: "hex" | "base64"hex or base64
StaticcreateStaticcreateCreates an ObjectId from a hex string representation of an ObjectId.
create a ObjectId from a passed in 24 character hexstring.
StaticcreateCreates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
an integer number representing a number of seconds.
StaticgenerateGenerate a 12 byte id buffer used in ObjectId's
Optionaltime: numberpass in a second based timestamp.
StaticisChecks if a value can be used to create a valid bson ObjectId
any JS value
A class representation of the BSON ObjectId type.