ObjectIdGenerator
An object responsible for generating new ObjectId instances.
This object is similar to kotlin.time.Clock: a Clock
is a way to generate Instant
instances, and services that need to generate instants should receive a clock via dependency injection. Similarly, services that generate IDs should get a generator via dependency injection.
To get the real generator instance, see the database's opensavvy.ktmongo.bson.BsonContext.
Inheritors
Types
Link copied to clipboard
class Default(clock: Clock = Clock.System, random: Random = Random, processId: Long = random.nextLong(0, ObjectId.PROCESS_ID_BOUND)) : ObjectIdGenerator
The default ObjectIdGenerator, implementing the MongoDB ObjectId generation algorithm.
Link copied to clipboard
Hardcoded ObjectId generator with a deterministic input sequence.
Functions
Link copied to clipboard
Creates a new instance of an ObjectId.