sealed abstract class BSONDocument extends BSONValue with ElementProducer with BSONDocumentLowPriority
A BSONDocument structure (BSON type 0x03).
A BSONDocument is basically a set of fields (String, BSONValue).
Note: The insertion/initial order of the fields may not be maintained through the operations.
- Self Type
- BSONDocument
- Alphabetic
- By Inheritance
- BSONDocument
- BSONDocumentLowPriority
- ElementProducer
- Producer
- BSONValue
- AnyRef
- Any
- by identityValueProducer
- by valueProducer
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def elements: Seq[BSONElement]
The document fields as a sequence of BSONElements.
- abstract def headOption: Option[BSONElement]
The first/mandatory element, if any
- abstract def isEmpty: Boolean
Indicates whether this document is empty
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from BSONDocument toany2stringadd[BSONDocument] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- final def ++(seq: BSONElement*): BSONDocument
Creates a new BSONDocument containing all the elements of this one and the specified element sequence.
- final def ++(doc: BSONDocument): BSONDocument
Returns the BSONDocument containing all the elements of this one and the elements of the given document.
- def ++(producers: ElementProducer*): BSONDocument
Creates a new BSONDocument containing all the elements of this one and the specified element producers.
Creates a new BSONDocument containing all the elements of this one and the specified element producers.
- Definition Classes
- BSONDocumentLowPriority
- final def --(keys: String*): BSONDocument
Returns a set without the values corresponding to the specified keys.
- def ->[B](y: B): (BSONDocument, B)
- Implicit
- This member is added by an implicit conversion from BSONDocument toArrowAssoc[BSONDocument] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def asOpt[T](implicit reader: BSONReader[T]): Option[T]
Optionally parses this value as a
Tone.Optionally parses this value as a
Tone.- returns
Somesuccessfully parsed value, orNoneif failsimport scala.util.Try import reactivemongo.api.bson.BSONValue def foo(v: BSONValue): Option[String] = v.asOpt[String]
- Definition Classes
- BSONValue
- final def asTry[T](implicit reader: BSONReader[T]): Try[T]
Tries to parse this value as a
Tone.Tries to parse this value as a
Tone.import scala.util.Try import reactivemongo.api.bson.BSONValue def foo(v: BSONValue): Try[String] = v.asTry[String]
- Definition Classes
- BSONValue
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final val code: Byte
The code indicating the BSON type for this value
The code indicating the BSON type for this value
- Definition Classes
- BSONDocument → BSONValue
- def contains(key: String): Boolean
Checks whether the given key is found in this element set.
Checks whether the given key is found in this element set.
- key
the key to be found in the document
- returns
true if the key is found
- def ensuring(cond: (BSONDocument) => Boolean, msg: => Any): BSONDocument
- Implicit
- This member is added by an implicit conversion from BSONDocument toEnsuring[BSONDocument] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (BSONDocument) => Boolean): BSONDocument
- Implicit
- This member is added by an implicit conversion from BSONDocument toEnsuring[BSONDocument] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): BSONDocument
- Implicit
- This member is added by an implicit conversion from BSONDocument toEnsuring[BSONDocument] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): BSONDocument
- Implicit
- This member is added by an implicit conversion from BSONDocument toEnsuring[BSONDocument] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(that: Any): Boolean
- Definition Classes
- BSONDocument → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from BSONDocument toStringFormat[BSONDocument] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
- final def get(key: String): Option[BSONValue]
Returns the BSONValue associated with the given
key.Returns the BSONValue associated with the given
key. If the key cannot be found, returnsNone.- key
the key to be found in the document
- final def getAsOpt[T](key: String)(implicit reader: BSONReader[T]): Option[T]
Returns the BSONValue associated with the given
key, and converts it with the given implicit BSONReader.Returns the BSONValue associated with the given
key, and converts it with the given implicit BSONReader.If there is no matching value, or the value could not be deserialized, or converted, returns a
None.- key
the key to be found in the document
- Note
When implementing a custom reader, getAsTry must be preferred.
- final def getAsTry[T](key: String)(implicit reader: BSONReader[T]): Try[T]
Gets the BSONValue associated with the given
key, and converts it with the given implicit BSONReader.Gets the BSONValue associated with the given
key, and converts it with the given implicit BSONReader.If there is no matching value, or the value could not be deserialized, or converted, returns a
Failure.The
Failuremay hold a exceptions.BSONValueNotFoundException, if the key could not be found.- key
the key to be found in the document
- final def getAsUnflattenedTry[T](key: String)(implicit reader: BSONReader[T]): Try[Option[T]]
Gets the BSONValue at the given
key, and converts it with the given implicit BSONReader.Gets the BSONValue at the given
key, and converts it with the given implicit BSONReader.If there is no matching value,
Success(None)is returned. If there is a value, it must be valid or aFailureis returned.- key
the key to be found in the document
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- BSONDocument → AnyRef → Any
- 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 size: Int
The number of fields
The number of fields
- Annotations
- @inline()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toMap: Map[String, BSONValue]
Returns the map representation for this document.
Returns the map representation for this document.
- Annotations
- @inline()
- def toString(): String
- Definition Classes
- BSONDocument → AnyRef → Any
- final def values: Iterable[BSONValue]
Returns the values of the document fields.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def →[B](y: B): (BSONDocument, B)
- Implicit
- This member is added by an implicit conversion from BSONDocument toArrowAssoc[BSONDocument] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.