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
#rawImplementation of $SerializeForCollection
for TableCodec
Compares 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.
Static
[$Implementation of $DeserializeForCollection
for TableCodec
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