Packages

object BSONDocument

BSONDocument factories & utilities.

reactivemongo.api.bson.BSONDocument("foo" -> 1, "bar" -> "lorem")
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BSONDocument
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Strict = BSONDocument with BSONStrictDocument

    EXPERIMENTAL

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(elms: Iterable[(String, BSONValue)]): BSONDocument

    Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) .

    Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) .

    import reactivemongo.api.bson._
    
    BSONDocument(Seq(
      "foo" -> BSONInteger(1), "bar" -> BSONString("lorem")))
    // { 'foo': 1, 'bar': 'lorem' }
  5. def apply(elms: ElementProducer*): BSONDocument

    Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) .

    Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) . In case of conversion error for a field value, the field is ignored.

    reactivemongo.api.bson.BSONDocument(
      "foo" -> 1, "bar" -> "lorem"
    ) // => { 'foo': 1, 'bar': 'lorem' }
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. val empty: BSONDocument

    An empty BSONDocument.

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def newBuilder: Builder[ElementProducer, BSONDocument]

    EXPERIMENTAL: Returns a BSONDocument builder.

    EXPERIMENTAL: Returns a BSONDocument builder.

    import reactivemongo.api.bson.{ BSONDocument, ElementProducer }
    
    val builder = BSONDocument.newBuilder
    
    builder += ("foo" -> 1)
    builder ++= Seq("bar" -> "lorem", "ipsum" -> 3.45D)
    builder ++= Some[ElementProducer]("dolor" -> 6L)
    
    // builder.result() == {'foo':1, 'bar':'lorem', 'ipsum':3.45, 'dolor':6}
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. def pretty(doc: BSONDocument): String

    Returns a String representing the given BSONDocument.

    Returns a String representing the given BSONDocument.

    import reactivemongo.api.bson.BSONDocument
    
    def printDoc(doc: BSONDocument): String = BSONDocument.pretty(doc)
    See also

    BSONValue$.pretty

  20. def safe(elms: ElementProducer*): Try[BSONDocument]

    EXPERIMENTAL: Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) .

    EXPERIMENTAL: Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept) . Fails if any error occurs while converting the field values.

    reactivemongo.api.bson.BSONDocument.safe(
      "foo" -> 1, "bar" -> "lorem"
    ) // => Success: { 'foo': 1, 'bar': 'lorem' }
  21. def strict(elms: Iterable[(String, BSONValue)]): Strict

    EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name).

    EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name). Then append operations on such document will maintain element unicity by field name (see BSONStrictDocument.++).

    import reactivemongo.api.bson._
    
    BSONDocument.strict(Seq(
      "foo" -> BSONInteger(1), "foo" -> BSONString("lorem")))
    // { 'foo': 1 }
  22. def strict(elms: ElementProducer*): Strict

    EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name).

    EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name). Then append operations on such document will maintain element unicity by field name (see BSONStrictDocument.++).

    reactivemongo.api.bson.BSONDocument("foo" -> 1, "bar" -> 2, "foo" -> 3)
    // => { "foo": 1, "bar": 2 } : No "foo": 3
  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. def unapply(that: Any): Option[Seq[BSONElement]]

    Extracts the elements if that's a BSONDocument.

    Extracts the elements if that's a BSONDocument.

    import reactivemongo.api.bson.{ BSONDocument, BSONValue }
    
    def names(v: BSONValue): Seq[String] = v match {
      case BSONDocument(elements) => elements.map(_.name)
      case _ => Seq.empty[String]
    }
  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