Packages

object BSONDocumentReader

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONDocumentReader
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply[T](read: (BSONDocument) => T): BSONDocumentReader[T]

    Creates a BSONDocumentReader based on the given read function.

    Creates a BSONDocumentReader based on the given read function.

    import reactivemongo.api.bson.BSONDocumentReader
    
    case class Foo(name: String, age: Int)
    
    val fooReader: BSONDocumentReader[Foo] = BSONDocumentReader[Foo] { doc =>
      (for {
        nme <- doc.string("name")
        age <- doc.int("age")
      } yield Foo(nme, age)).getOrElse(Foo("unknown", -1))
    }
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def collect[T](read: PartialFunction[BSONDocument, T]): BSONDocumentReader[T]

    EXPERIMENTAL: Creates a BSONDocumentReader based on the given partial function.

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def field[T](name: String)(implicit r: BSONReader[T]): BSONDocumentReader[T]

    EXPERIMENTAL: Creates a BSONDocumentReader that reads a single document field.

    EXPERIMENTAL: Creates a BSONDocumentReader that reads a single document field.

    name

    the name of the field to be read

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentReader }
    
    val reader = BSONDocumentReader.field[String]("foo")
    
    val doc = BSONDocument("foo" -> "bar")
    
    reader.readTry(doc) // Success("bar")
  11. def from[T](read: (BSONDocument) => Try[T]): BSONDocumentReader[T]

    Creates a BSONDocumentReader based on the given safe read function.

    Creates a BSONDocumentReader based on the given safe read function.

    import reactivemongo.api.bson.BSONDocumentReader
    
    case class Foo(name: String, age: Int)
    
    val fooReader: BSONDocumentReader[Foo] =
      BSONDocumentReader.from[Foo] { doc =>
        for {
          nme <- doc.getAsTry[String]("name")
          age <- doc.getAsTry[Int]("age")
        } yield Foo(nme, age)
      }
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def option[T](read: (BSONDocument) => Option[T]): BSONDocumentReader[T]

    Creates a BSONDocumentReader based on the given read function.

    Creates a BSONDocumentReader based on the given read function.

    import reactivemongo.api.bson.BSONDocumentReader
    
    case class Foo(name: String, age: Int)
    
    val fooReader: BSONDocumentReader[Foo] =
      BSONDocumentReader.option[Foo] { doc =>
        for {
          nme <- doc.string("name")
          age <- doc.int("age")
        } yield Foo(nme, age)
      }
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. def tuple2[A, B](field1: String, field2: String)(implicit arg0: BSONReader[A], arg1: BSONReader[B]): BSONDocumentReader[(A, B)]

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentReader }
    
    val reader = BSONDocumentReader.tuple2[String, Int]("name", "age")
    
    val doc = BSONDocument("name" -> "Foo", "age" -> 20)
    
    reader.readTry(doc) // => Success(("Foo", 20))
  22. def tuple3[A, B, C](field1: String, field2: String, field3: String)(implicit arg0: BSONReader[A], arg1: BSONReader[B], arg2: BSONReader[C]): BSONDocumentReader[(A, B, C)]

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    See also

    tuple2

  23. def tuple4[A, B, C, D](field1: String, field2: String, field3: String, field4: String)(implicit arg0: BSONReader[A], arg1: BSONReader[B], arg2: BSONReader[C], arg3: BSONReader[D]): BSONDocumentReader[(A, B, C, D)]

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    See also

    tuple2

  24. def tuple5[A, B, C, D, E](field1: String, field2: String, field3: String, field4: String, field5: String)(implicit arg0: BSONReader[A], arg1: BSONReader[B], arg2: BSONReader[C], arg3: BSONReader[D], arg4: BSONReader[E]): BSONDocumentReader[(A, B, C, D, E)]

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    EXPERIMENTAL: Creates a BSONDocumentReader that reads the specified document fields as tuple elements.

    See also

    tuple2

  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped