Default

class Default(clock: Clock = Clock.System, random: Random = Random, processId: Long = random.nextLong(0, ObjectId.PROCESS_ID_BOUND)) : ObjectIdGenerator(source)

The default ObjectIdGenerator, implementing the MongoDB ObjectId generation algorithm.

Note that it isn't guaranteed that IDs are generated monotonically: it is possible that an ID is lesser (according to ObjectId.compareTo) than one generated previously, but only if both were generated during the same second.

However, it is guaranteed until the year 2016 that an ID is always strictly greater than one generated in a previous second.

Constructors

Link copied to clipboard
constructor(clock: Clock = Clock.System, random: Random = Random, processId: Long = random.nextLong(0, ObjectId.PROCESS_ID_BOUND))

Functions

Link copied to clipboard
open override fun newId(): ObjectId

Creates a new instance of an ObjectId.