Packages

sealed abstract class BSONObjectID extends BSONValue

BSON ObjectId value.

import scala.util.Try
import reactivemongo.api.bson.BSONObjectID

val oid: BSONObjectID = BSONObjectID.generate()

def foo: Try[BSONObjectID] = BSONObjectID.parse(oid.stringify)

| Timestamp (seconds) | Machine identifier | Thread identifier | Increment

| --- | --- | --- | ---

| 4 bytes | 3 bytes | 2 bytes | 3 bytes

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONObjectID
  2. BSONValue
  3. AnyRef
  4. Any
Implicitly
  1. by valueProducer
  2. by identityValueProducer
  3. by any2stringadd
  4. by StringFormat
  5. by Ensuring
  6. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def timeSecond: Int

    The time of this BSONObjectId, in seconds

Concrete Value Members

  1. final def asOpt[T](implicit reader: BSONReader[T]): Option[T]

    Optionally parses this value as a T one.

    Optionally parses this value as a T one.

    returns

    Some successfully parsed value, or None if fails

    import reactivemongo.api.bson.BSONValue
    
    def foo(v: BSONValue): Option[String] = v.asOpt[String]
    Definition Classes
    BSONValue
    Annotations
    @inline()
  2. final def asTry[T](implicit reader: BSONReader[T]): Try[T]

    Tries to parse this value as a T one.

    Tries to parse this value as a T one.

    import scala.util.Try
    import reactivemongo.api.bson.BSONValue
    
    def foo(v: BSONValue): Try[String] = v.asTry[String]
    Definition Classes
    BSONValue
  3. final def byteArray: Array[Byte]

    Returns the whole binary content as array.

  4. val byteCode: Byte

    The code indicating the BSON type for this value as Byte

    The code indicating the BSON type for this value as Byte

    Definition Classes
    BSONObjectIDBSONValue
  5. val code: Int

    The code indicating the BSON type for this value

    The code indicating the BSON type for this value

    Definition Classes
    BSONObjectIDBSONValue
  6. def equals(that: Any): Boolean
    Definition Classes
    BSONObjectID → AnyRef → Any
  7. lazy val hashCode: Int
    Definition Classes
    BSONObjectID → AnyRef → Any
  8. lazy val stringify: String

    The hexadecimal String representation.

    The hexadecimal String representation.

    import reactivemongo.api.bson.BSONObjectID
    
    def foo(oid: BSONObjectID): scala.util.Try[BSONObjectID] = {
      val repr: String = oid.stringify
      BSONObjectID.parse(repr)
    }
  9. final def time: Long

    The time of this BSONObjectId, in milliseconds

    The time of this BSONObjectId, in milliseconds

    Annotations
    @inline()
  10. def toString(): String
    Definition Classes
    BSONObjectID → AnyRef → Any