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()
  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 finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. 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)
      }
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. 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)
      }
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. 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))
  23. 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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped