Packages

object BSONObjectID extends Serializable

Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONObjectID
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def apply(array: Array[Byte]): BSONObjectID
  2. def fromTime(timeMillis: Long, fillOnlyTimestamp: Boolean = true): BSONObjectID

    Generates a new BSON ObjectID from the given timestamp in milliseconds.

    Generates a new BSON ObjectID from the given timestamp in milliseconds.

    The included timestamp is the number of seconds since epoch, so a BSONObjectID time part has only a precision up to the second. To get a reasonably unique ID, you _must_ set onlyTimestamp to false.

    Crafting a BSONObjectID from a timestamp with fillOnlyTimestamp set to true is helpful for range queries, eg if you want of find documents an _id field which timestamp part is greater than or lesser than the one of another id.

    If you do not intend to use the produced BSONObjectID for range queries, then you'd rather use the generate method instead.

    fillOnlyTimestamp

    if true, the returned BSONObjectID will only have the timestamp bytes set; the other will be set to zero.

  3. def generate(): BSONObjectID

    Generates a new BSON ObjectID using the current time.

    Generates a new BSON ObjectID using the current time.

    See also

    fromTime

  4. def parse(id: String): Try[BSONObjectID]

    Tries to make a BSON ObjectId from a hexadecimal string representation.

  5. def unapply(id: BSONObjectID): Option[Array[Byte]]