Creates a new ObjectId instance.
If id is provided, it must be a 24-character hex string. Otherwise, a new ObjectId is generated.
Optional id: null | string | numberThe ObjectId string.
Whether to validate the ObjectId string. Defaults to true.
Private Readonly _rawCompares this ObjectId to another ObjectId.
The other ObjectId can be an ObjectId instance or a string.
An ObjectId is considered equal to another ObjectId if their string representations are equal.
The ObjectId to compare to.
true if the ObjectIds are equal, false otherwise.
Represents an ObjectId that can be used as an _id in the DataAPI.
Provides methods for generating ObjectIds and getting the timestamp of an ObjectId.
Example
Example