Object/Trait

reactivemongo.api.bson

BSONDocumentReader

Related Docs: trait BSONDocumentReader | package bson

Permalink

object BSONDocumentReader

BSONDocumentReader factories

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. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[T](read: (BSONDocument) ⇒ T): BSONDocumentReader[T]

    Permalink

    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

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def collect[T](read: PartialFunction[BSONDocument, T]): BSONDocumentReader[T]

    Permalink

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

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def from[T](read: (BSONDocument) ⇒ Try[T]): BSONDocumentReader[T]

    Permalink

    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[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def option[T](read: (BSONDocument) ⇒ Option[T]): BSONDocumentReader[T]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. def tuple2[A, B](field1: String, field2: String)(implicit arg0: BSONReader[A], arg1: BSONReader[B]): BSONDocumentReader[(A, B)]

    Permalink

    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)]

    Permalink

    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)]

    Permalink

    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)]

    Permalink

    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(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped