object BSONDocumentReader
BSONDocumentReader factories
- Alphabetic
- By Inheritance
- BSONDocumentReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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)) }
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
collect[T](read: PartialFunction[BSONDocument, T]): BSONDocumentReader[T]
EXPERIMENTAL: Creates a BSONDocumentReader based on the given partial function.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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")
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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) }
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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) }
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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))
-
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
-
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
-
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
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()