Packages

object BSONDocumentWriter

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONDocumentWriter
  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](write: (T) => BSONDocument): BSONDocumentWriter[T]

    Creates a BSONDocumentWriter based on the given write function.

    Creates a BSONDocumentWriter based on the given write function. This function is called within a scala.util.Try.

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentWriter }
    
    case class Foo(value: String)
    
    val foo: BSONDocumentWriter[Foo] =
      BSONDocumentWriter { f: Foo => BSONDocument("value" -> f.value) }
  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](write: PartialFunction[T, BSONDocument]): BSONDocumentWriter[T]

    Creates a BSONDocumentWriter based on the given partial function.

    Creates a BSONDocumentWriter based on the given partial function.

    A exceptions.ValueDoesNotMatchException is returned as Failure for any value that is not matched by the write function.

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentWriter }
    
    case class Foo(value: String)
    
    val writer = BSONDocumentWriter.collect[Foo] {
      case Foo(value) if value.nonEmpty =>
        BSONDocument("value" -> value)
    }
  8. def collectFrom[T](write: PartialFunction[T, Try[BSONDocument]]): BSONDocumentWriter[T]

    EXPERIMENTAL: Creates a BSONDocumentWriter based on the given partially safe write function.

    EXPERIMENTAL: Creates a BSONDocumentWriter based on the given partially safe write function.

    A exceptions.ValueDoesNotMatchException is returned as Failure for any value that is not matched by the write function.

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentWriter }
    
    case class Foo(value: String)
    
    val writer = BSONDocumentWriter.collectFrom[Foo] {
      case Foo(value) if value.nonEmpty =>
        scala.util.Success(BSONDocument("value" -> value))
    }
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def field[T](name: String)(implicit w: BSONWriter[T]): BSONDocumentWriter[T]

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes a single value as a BSONDocument with a single field.

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes a single value as a BSONDocument with a single field.

    name

    the name of the field to be written

    import reactivemongo.api.bson.BSONDocumentWriter
    
    val writer = BSONDocumentWriter.field[String]("foo")
    
    writer.writeTry("bar")
    // => Success: {'foo': 'bar'}
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. def from[T](write: (T) => Try[BSONDocument]): BSONDocumentWriter[T]

    Creates a BSONDocumentWriter based on the given write safe function.

    Creates a BSONDocumentWriter based on the given write safe function.

    import scala.util.Success
    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentWriter }
    
    case class Foo(value: String)
    
    val writer = BSONDocumentWriter.from[Foo] { foo =>
      Success(BSONDocument("value" -> foo.value))
    }
    write

    the safe function to write T values as BSON

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def option[T](write: (T) => Option[BSONDocument]): BSONDocumentWriter[T]

    Creates a BSONWriter based on the given write function.

    Creates a BSONWriter based on the given write function.

    import reactivemongo.api.bson.{ BSONDocument, BSONDocumentWriter }
    
    case class Foo(value: String)
    
    val writer = BSONDocumentWriter.option[Foo] { foo =>
      Some(BSONDocument("value" -> foo.value))
    }
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. def tuple2[A, B](field1: String, field2: String)(implicit arg0: BSONWriter[A], arg1: BSONWriter[B]): BSONDocumentWriter[(A, B)]

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes tuple elements as BSONDocument fields.

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes tuple elements as BSONDocument fields.

    import reactivemongo.api.bson.BSONDocumentWriter
    
    val writer = BSONDocumentWriter.tuple2[String, Int]("name", "age")
    
    writer.writeTry("Foo" -> 20)
    // => Success: {'name': 'Foo', 'age': 20}
  24. def tuple3[A, B, C](field1: String, field2: String, field3: String)(implicit arg0: BSONWriter[A], arg1: BSONWriter[B], arg2: BSONWriter[C]): BSONDocumentWriter[(A, B, C)]

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes tuple elements as BSONDocument fields.

  25. def tuple4[A, B, C, D](field1: String, field2: String, field3: String, field4: String)(implicit arg0: BSONWriter[A], arg1: BSONWriter[B], arg2: BSONWriter[C], arg3: BSONWriter[D]): BSONDocumentWriter[(A, B, C, D)]

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes tuple elements as BSONDocument fields.

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

    EXPERIMENTAL: Creates a BSONDocumentWriter that writes tuple elements as BSONDocument fields.

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

Inherited from AnyRef

Inherited from Any

Ungrouped