package bson
BSON main API
import reactivemongo.api.bson._ // { "name": "Johny", "surname": "Doe", "age": 28, "months": [1, 2, 3] } BSONDocument.empty ++ ("name" -> "Johny") ++ ("surname" -> "Doe") ++ ("age" -> 28) ++ ("months" -> array(1, 2, 3)) // { "_id": generatedId, "name": "Jane", "surname": "Doe", "age": 28, // "months": [1, 2, 3], "details": { "salary": 12345, // "inventory": ["foo", 7.8, 0, false] } } document.++("_id" -> generateId, "name" -> "Jane", "surname" -> "Doe", "age" -> 28, "months" -> array(1, 2, 3), "details" -> document( "salary" -> 12345L, "inventory" -> array("foo", 7.8, 0L, false)))
System properties:
The following properties can be set (e.g. using JVM -D
options).
reactivemongo.api.bson.bufferSizeBytes
(integer; default:96
): Number of bytes used as initial size when allocating a new buffer.reactivemongo.api.bson.document.strict
(boolean; default:false
): Flag to enable strict reading of document (filter duplicate fields, see BSONDocument.asStrict).
- Alphabetic
- By Inheritance
- bson
- PackageCompat
- Utils
- Aliases
- DefaultBSONHandlers
- BSONIdentityHandlers
- BSONIdentityLowPriorityHandlers
- LowPriority1BSONHandlers
- LowPriority2BSONHandlers
- LowPriority3BSONHandlers
- LowPriority4BSONHandlers
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package exceptions
Type Members
- sealed abstract class BSONArray extends BSONValue
A
BSONArray
(type0x04
) is a indexed sequence of BSONValue.A
BSONArray
(type0x04
) is a indexed sequence of BSONValue.import reactivemongo.api.bson._ BSONArray(BSONString("foo"), BSONDouble(1.2D))
- abstract class BSONArrayCollectionReader[M[_], T] extends BSONReader[M[T]]
- Attributes
- protected
- Definition Classes
- LowPriority1BSONHandlers
- class BSONArrayCollectionWriter[T, Repr] extends BSONWriter[Repr]
- Attributes
- protected
- Definition Classes
- LowPriority1BSONHandlers
- final class BSONBinary extends BSONValue
A BSON binary value.
A BSON binary value.
import reactivemongo.api.bson.{ BSONBinary, Subtype } BSONBinary("foo".getBytes("UTF-8"), Subtype.GenericBinarySubtype)
- final class BSONBoolean extends BSONValue with Value
BSON boolean value
- sealed trait BSONBooleanLike extends AnyRef
A BSON value that can be seen as a boolean.
A BSON value that can be seen as a boolean.
Conversions:
number = 0 ~> false
number != 0 ~> true
boolean
undefined ~> false
null ~> false
import scala.util.Success import reactivemongo.api.bson.{ BSONBooleanLike, BSONDocument, BSONInteger } val bi = BSONInteger(1) assert(bi.asTry[BSONBooleanLike].flatMap(_.toBoolean) == Success(true)) val doc = BSONDocument("field" -> bi) assert(doc.getAsTry[BSONBooleanLike]("field"). flatMap(_.toBoolean) == Success(true))
- final class BSONDateTime extends BSONValue with Value
BSON date time value
- final class BSONDecimal extends BSONValue with Value with Value
Value wrapper for a BSON 128-bit decimal.
- sealed abstract class BSONDocument extends BSONValue with ElementProducer with SafeProducer[BSONElement] with BSONDocumentLowPriority with BSONDocumentExperimental
A
BSONDocument
structure (BSON type0x03
).A
BSONDocument
structure (BSON type0x03
).A
BSONDocument
is an unordered set of fields(String, BSONValue)
.Note: The insertion/initial order of the fields may not be maintained through the operations.
- trait BSONDocumentHandler[T] extends BSONDocumentReader[T] with BSONDocumentWriter[T] with BSONHandler[T]
Reads and writers
T
values to/from BSONDocument. - trait BSONDocumentReader[T] extends BSONReader[T]
BSONReader specialized for BSONDocument
- trait BSONDocumentWriter[T] extends BSONWriter[T]
BSONWriter specialized for BSONDocument
- final class BSONDouble extends BSONValue with Value with Value
A BSON Double.
A BSON Double.
reactivemongo.api.bson.BSONDouble(1.23D)
- sealed abstract class BSONElement extends ElementProducer with SafeProducer[BSONElement]
BSON element, typically a pair of name and BSONValue.
BSON element, typically a pair of name and BSONValue.
import reactivemongo.api.bson.{ BSONElement, BSONString } BSONElement("name", BSONString("value"))
- trait BSONHandler[T] extends BSONReader[T] with BSONWriter[T]
A BSON handler is able to both read and write
T
values from/to BSON representation.A BSON handler is able to both read and write
T
values from/to BSON representation.import scala.util.Try import reactivemongo.api.bson.{ BSONHandler, BSONValue } def roundtrip[T](value: T)(implicit handler: BSONHandler[T]): Try[Boolean] = for { bson: BSONValue <- handler.writeTry(value) dser <- handler.readTry(bson) } yield (dser == value) // true
- final class BSONInteger extends BSONValue with Value with Value
BSON Integer value
- final class BSONJavaScript extends BSONValue
BSON JavaScript value.
- final class BSONJavaScriptWS extends BSONValue
BSON JavaScript value with scope (WS).
- final class BSONLocalDateHandler extends BSONHandler[LocalDate] with SafeBSONWriter[LocalDate]
- Definition Classes
- DefaultBSONHandlers
- final class BSONLocalDateTimeHandler extends BSONHandler[LocalDateTime] with SafeBSONWriter[LocalDateTime]
- Definition Classes
- DefaultBSONHandlers
- final class BSONLong extends BSONValue with Value with Value
BSON Long value
- sealed trait BSONMaxKey extends BSONValue
BSON Max key value
- sealed trait BSONMinKey extends BSONValue
BSON Min key value
- sealed trait BSONNull extends BSONValue with Value
BSON null value
- sealed trait BSONNumberLike extends AnyRef
A BSON value that can be seen as a number.
A BSON value that can be seen as a number.
Conversions:
- numeric BSON types (BSONDecimal, BSONDouble, BSONInteger, BSONLong)
- BSON date/time ~> long (BSONDateTime
.value
) - BSON timestamp ~> long (BSONTimestamp.value)
import scala.util.Success import reactivemongo.api.bson.{ BSONNumberLike, BSONDocument, BSONInteger } val bi = BSONInteger(1) assert(bi.asTry[BSONNumberLike].flatMap(_.toLong) == Success(1L)) val doc = BSONDocument("field" -> bi) assert(doc.getAsTry[BSONNumberLike]("field"). flatMap(_.toDouble) == Success(1D))
- sealed abstract class BSONObjectID extends BSONValue
BSON ObjectId value.
BSON ObjectId value.
import scala.util.Try import reactivemongo.api.bson.BSONObjectID val oid: BSONObjectID = BSONObjectID.generate() def foo: Try[BSONObjectID] = BSONObjectID.parse(oid.stringify)
| Timestamp (seconds) | Machine identifier | Thread identifier | Increment
| --- | --- | --- | ---
| 4 bytes | 3 bytes | 2 bytes | 3 bytes
- final class BSONOffsetDateTimeHandler extends BSONHandler[OffsetDateTime] with SafeBSONWriter[OffsetDateTime]
- Definition Classes
- DefaultBSONHandlers
- trait BSONReader[T] extends AnyRef
A reader that produces an instance of
T
from a subtype of BSONValue. - final class BSONRegex extends BSONValue
BSON Regex value.
- sealed trait BSONStrictDocument extends BSONStrictDocumentLowPriority
EXPERIMENTAL: Strict documentation representation with at most one value per field name (no duplicate).
EXPERIMENTAL: Strict documentation representation with at most one value per field name (no duplicate).
import reactivemongo.api.bson.BSONDocument def strict1 = // { 'foo': 1 } BSONDocument.strict("foo" -> 1, "foo" -> 2) def strict2 = BSONDocument("foo" -> 1, "foo" -> 2).asStrict assert(strict1 == strict2)
- final class BSONString extends BSONValue
A BSON string.
A BSON string.
reactivemongo.api.bson.BSONString("foo")
- final class BSONSymbol extends BSONValue
BSON Symbol value.
- sealed abstract class BSONTimestamp extends BSONValue with Value
BSON Timestamp value
- sealed trait BSONUndefined extends BSONValue with Value
BSON undefined value
- sealed trait BSONValue extends AnyRef
A BSON value
- trait BSONWriter[T] extends AnyRef
A writer that produces a subtype of BSONValue from an instance of
T
. - final class BSONZonedDateTimeHandler extends BSONHandler[ZonedDateTime] with SafeBSONWriter[ZonedDateTime]
- Definition Classes
- DefaultBSONHandlers
- type BaseColl[T] = Iterable[T]
- Definition Classes
- Aliases
- sealed trait DocumentClass[T] extends AnyRef
Evidence that
T
can be serialized as a BSON document.Evidence that
T
can be serialized as a BSON document.- Annotations
- @silent()
- sealed trait ElementProducer extends Producer[BSONElement]
See BSONDocument
- trait FieldNaming extends (String) => String
Naming strategy, to map each class property to the corresponding field.
Naming strategy, to map each class property to the corresponding field.
import reactivemongo.api.bson.{ FieldNaming, MacroConfiguration } def initCfg(naming: FieldNaming): MacroConfiguration = MacroConfiguration(fieldNaming = naming)
- See also
- trait KeyReader[T] extends AnyRef
Mapping from a BSON string to
T
; Used by scala.collection.Map handlers.Mapping from a BSON string to
T
; Used by scala.collection.Map handlers.final class Foo(val v: String) extends AnyVal val bson = reactivemongo.api.bson.BSONDocument( "foo:key" -> 1, "foo:name" -> 2) import reactivemongo.api.bson.KeyReader implicit def fooKeyReader: KeyReader[Foo] = KeyReader[Foo] { str => new Foo(str.stripPrefix("foo:")) } reactivemongo.api.bson.BSON.readDocument[Map[Foo, Int]](bson) // Success: Map[Foo, Int]( // (new Foo("key") -> 1), // (new Foo("name") -> 2))
- trait KeyWriter[T] extends AnyRef
Mapping from a BSON string to
T
.Mapping from a BSON string to
T
. Used by scala.collection.Map handlers.final class Foo(val v: String) extends AnyVal val dict = Map[Foo, Int]( (new Foo("key") -> 1), (new Foo("name") -> 2)) import reactivemongo.api.bson.KeyWriter implicit def fooKeyWriter: KeyWriter[Foo] = KeyWriter[Foo] { foo => "foo:" + foo.v } reactivemongo.api.bson.BSON.writeDocument(dict) // Success = {'foo:key': 1, 'foo:name': 2}
- sealed trait MacroConfiguration extends AnyRef
Macro configuration;
Macro configuration;
It allows to configure compile time options, and behaviour to be retained at runtime (field & type naming).
import reactivemongo.api.bson.{ BSONDocumentReader, MacroConfiguration, Macros } case class Foo(name: String) val r1: BSONDocumentReader[Foo] = Macros.configured.reader[Foo] val r2: BSONDocumentReader[Foo] = Macros.configured( MacroConfiguration.simpleTypeName).reader[Foo]
- See also
- sealed trait MacroOptions extends AnyRef
Macros with 'Opts' suffix will take additional options in the form of type parameters that will customize behaviour of the macros during compilation.
Macros with 'Opts' suffix will take additional options in the form of type parameters that will customize behaviour of the macros during compilation.
import reactivemongo.api.bson.{ BSONDocumentWriter, Macros, MacroOptions } case class Bar(score: Float) val w: BSONDocumentWriter[Bar] = Macros.using[MacroOptions.Default].writer[Bar]
- sealed trait Producer[T] extends AnyRef
- type StringOps = scala.collection.StringOps
- Definition Classes
- Aliases
- sealed trait Subtype extends AnyRef
Binary Subtype
- trait TypeNaming extends (Class[_]) => String
Naming strategy, to map each class to a discriminator value.
Naming strategy, to map each class to a discriminator value.
import reactivemongo.api.bson.{ MacroConfiguration, TypeNaming } val cfg1 = MacroConfiguration(typeNaming = TypeNaming.FullName) val cfg2 = MacroConfiguration(typeNaming = TypeNaming.FullName) val cfg3 = MacroConfiguration( typeNaming = TypeNaming { (cls: Class[_]) => "_" + cls.getSimpleName })
- See also
- final class ¬[A, B] extends AnyRef
Type level evidence that type
A
is not typeB
.Type level evidence that type
A
is not typeB
.- Annotations
- @SuppressWarnings()
Value Members
- def array(values: Producer[BSONValue]*): BSONArray
Returns an array with given values.
Returns an array with given values.
import reactivemongo.api.bson._ val arr = array("bar", 1L) // [ 'bar', NumberLong(1) ]
- def array: BSONArray
Returns an empty array.
Returns an empty array.
import reactivemongo.api.bson._ val arr1 = BSONString("bar") +: array // [ 'bar' ] val arr2 = BSONInteger(1) +: arr1 // [ 1, 'bar' ]
- implicit def bsonArrayReader: BSONReader[BSONArray]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonArrayWriter: BSONWriter[BSONArray]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonBinaryReader: BSONReader[BSONBinary]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonBinaryWriter: BSONWriter[BSONBinary]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonBooleanReader: BSONReader[BSONBoolean]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonBooleanWriter: BSONWriter[BSONBoolean]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDateTimeReader: BSONReader[BSONDateTime]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDateTimeWriter: BSONWriter[BSONDateTime]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDecimalReader: BSONReader[BSONDecimal]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDecimalWriter: BSONWriter[BSONDecimal]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDocumentReader: BSONDocumentReader[BSONDocument]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDocumentWriter: BSONDocumentWriter[BSONDocument]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDoubleReader: BSONReader[BSONDouble]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonDoubleWriter: BSONWriter[BSONDouble]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonIntegerReader: BSONReader[BSONInteger]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonIntegerWriter: BSONWriter[BSONInteger]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonJavaScriptReader: BSONReader[BSONJavaScript]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonJavaScriptWSReader: BSONReader[BSONJavaScriptWS]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonJavaScriptWSWriter: BSONWriter[BSONJavaScriptWS]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonJavaScriptWriter: BSONWriter[BSONJavaScript]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- def bsonLocalDateHandler(zone: ZoneId): BSONHandler[LocalDate]
Returns a BSON handler for
java.time.LocalDate
, considering the specified timezone
.Returns a BSON handler for
java.time.LocalDate
, considering the specified timezone
.- Definition Classes
- DefaultBSONHandlers
- Annotations
- @inline()
- implicit val bsonLocalDateHandler: BSONHandler[LocalDate]
- Definition Classes
- DefaultBSONHandlers
- def bsonLocalDateTimeHandler(zone: ZoneId): BSONHandler[LocalDateTime]
Returns a BSON handler for
java.time.LocalDateTime
, considering the specified timezone
.Returns a BSON handler for
java.time.LocalDateTime
, considering the specified timezone
.- Definition Classes
- DefaultBSONHandlers
- Annotations
- @inline()
- implicit val bsonLocalDateTimeHandler: BSONHandler[LocalDateTime]
- Definition Classes
- DefaultBSONHandlers
- implicit def bsonLongReader: BSONReader[BSONLong]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonLongWriter: BSONWriter[BSONLong]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonMapKeyWriter[K, V <: BSONValue](implicit keyWriter: KeyWriter[K]): BSONDocumentWriter[Map[K, V]]
- Definition Classes
- LowPriority3BSONHandlers
- implicit def bsonMapWriter[V <: BSONValue]: BSONDocumentWriter[Map[String, V]]
- Definition Classes
- LowPriority1BSONHandlers
- implicit def bsonMaxKeyReader: BSONReader[BSONMaxKey]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonMaxKeyWriter: BSONWriter[BSONMaxKey]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonMinKeyReader: BSONReader[BSONMinKey]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonMinKeyWriter: BSONWriter[BSONMinKey]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonNullReader: BSONReader[BSONNull]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonNullWriter: BSONWriter[BSONNull]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonObjectIDReader: BSONReader[BSONObjectID]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonObjectIDWriter: BSONWriter[BSONObjectID]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- def bsonOffsetDateTimeHandler(zone: ZoneId): BSONHandler[OffsetDateTime]
Returns a BSON handler for
java.time.OffsetDateTime
, considering the specified timezone
.Returns a BSON handler for
java.time.OffsetDateTime
, considering the specified timezone
.- Definition Classes
- DefaultBSONHandlers
- Annotations
- @inline()
- implicit val bsonOffsetDateTimeHandler: BSONHandler[OffsetDateTime]
- Definition Classes
- DefaultBSONHandlers
- implicit def bsonRegexReader: BSONReader[BSONRegex]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonRegexWriter: BSONWriter[BSONRegex]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonStringReader: BSONReader[BSONString]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonStringWriter: BSONWriter[BSONString]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonSymbolReader: BSONReader[BSONSymbol]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonSymbolWriter: BSONWriter[BSONSymbol]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonTimestampReader: BSONReader[BSONTimestamp]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonTimestampWriter: BSONWriter[BSONTimestamp]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonUndefinedReader: BSONReader[BSONUndefined]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- implicit def bsonUndefinedWriter: BSONWriter[BSONUndefined]
- Definition Classes
- BSONIdentityHandlers
- Annotations
- @inline()
- def bsonZonedDateTimeHandler(zone: ZoneId): BSONHandler[ZonedDateTime]
Returns a BSON handler for
java.time.ZonedDateTime
, considering the specified timezone
.Returns a BSON handler for
java.time.ZonedDateTime
, considering the specified timezone
.- Definition Classes
- DefaultBSONHandlers
- Annotations
- @inline()
- implicit val bsonZonedDateTimeHandler: BSONHandler[ZonedDateTime]
- Definition Classes
- DefaultBSONHandlers
- implicit final def collectionReader[M[_], T](implicit f: Factory[T, M[T]], reader: BSONReader[T]): BSONReader[M[T]]
- Definition Classes
- LowPriority1BSONHandlers
- implicit def collectionWriter[T, Repr](implicit ev: (Repr) => Iterable[T], writer: BSONWriter[T], notOption: ¬[Repr, Option[T]]): BSONWriter[Repr]
- Definition Classes
- LowPriority1BSONHandlers
- Annotations
- @silent()
- def document(elements: ElementProducer*): BSONDocument
Returns a document with given elements.
Returns a document with given elements.
import reactivemongo.api.bson._ val doc = document("foo" -> 1) // { 'foo': 1 }
- def document: BSONDocument
Returns an empty document.
Returns an empty document.
import reactivemongo.api.bson._ val doc = document ++ ("foo" -> 1) // { 'foo': 1 }
- def generateId: BSONObjectID
Returns a newly generated object ID.
- implicit def mapKeyReader[K, V](implicit keyReader: KeyReader[K], valueReader: BSONReader[V]): BSONDocumentReader[Map[K, V]]
- Definition Classes
- LowPriority2BSONHandlers
- implicit def mapKeySafeWriter[K, V](implicit keyWriter: KeyWriter[K] with SafeKeyWriter[K], valueWriter: BSONWriter[V] with SafeBSONWriter[V]): BSONDocumentWriter[Map[K, V]]
- Definition Classes
- LowPriority3BSONHandlers
- implicit def mapKeyWriter[K, V](implicit keyWriter: KeyWriter[K], valueWriter: BSONWriter[V]): BSONDocumentWriter[Map[K, V]]
- Definition Classes
- LowPriority4BSONHandlers
- implicit def mapReader[V](implicit valueReader: BSONReader[V]): BSONDocumentReader[Map[String, V]]
- Definition Classes
- LowPriority1BSONHandlers
- implicit def mapSafeWriter[V](implicit valueWriter: BSONWriter[V] with SafeBSONWriter[V]): BSONDocumentWriter[Map[String, V]]
- Definition Classes
- LowPriority1BSONHandlers
- implicit def mapWriter[V](implicit valueWriter: BSONWriter[V]): BSONDocumentWriter[Map[String, V]]
- Definition Classes
- LowPriority2BSONHandlers
- def maxKey: BSONMaxKey
Returns a BSON MaxKey value
- macro def migrationRequired[A](details: String): A
Keeps a
A
statement but raise a migration error at compile-time.Keeps a
A
statement but raise a migration error at compile-time.The compilation error can be disabled by setting the system property
reactivemongo.api.migrationRequired.nonFatal
totrue
.- Definition Classes
- PackageCompat
- Annotations
- @SuppressWarnings()
- def minKey: BSONMinKey
Returns a BSON MinKey value
- implicit def nameValueOrdering[T <: BSONValue]: Ordering[(String, T)]
Key/value ordering
Key/value ordering
import reactivemongo.api.bson.{ BSONString, nameValueOrdering } Seq("foo" -> BSONString("1"), "bar" -> BSONString("1")). sorted // == [ "bar" -> .., "foo" -> .. ]
- def null: BSONNull
Returns a BSON Null value
- def undefined: BSONUndefined
Returns a BSON Undefined value
- object BSON
Utility functions
- object BSONArray
BSONArray utilities
BSONArray utilities
import reactivemongo.api.bson.{ BSONArray, BSONString } BSONArray("foo", 1) match { case BSONArray(BSONString(s) +: _) => s == "foo" case _ => false }
- object BSONBinary
BSONBinary utilities
BSONBinary utilities
import reactivemongo.api.bson.{ BSONBinary, Subtype } val bin1 = BSONBinary( "foo".getBytes("UTF-8"), Subtype.GenericBinarySubtype) // See Subtype.UuidSubtype val uuid = BSONBinary(java.util.UUID.randomUUID())
- implicit object BSONBinaryHandler extends BSONHandler[Array[Byte]] with SafeBSONWriter[Array[Byte]]
- Definition Classes
- DefaultBSONHandlers
- object BSONBoolean
BSONBoolean factories & utilities
- implicit object BSONBooleanHandler extends BSONHandler[Boolean] with SafeBSONWriter[Boolean]
- Definition Classes
- DefaultBSONHandlers
- object BSONBooleanLike
BSONBooleanLike utilities
- implicit object BSONByteHandler extends BSONHandler[Byte] with SafeBSONWriter[Byte]
- Definition Classes
- DefaultBSONHandlers
- implicit object BSONCharHandler extends BSONHandler[Char] with SafeBSONWriter[Char]
- Definition Classes
- DefaultBSONHandlers
- object BSONDateTime
BSONDateTime factories & utilities
- implicit object BSONDateTimeHandler extends BSONHandler[Instant] with SafeBSONWriter[Instant]
- Definition Classes
- DefaultBSONHandlers
- object BSONDecimal
BSONDecimal factories & utilities
- implicit object BSONDecimalHandler extends BSONHandler[BigDecimal]
- Definition Classes
- DefaultBSONHandlers
- object BSONDocument
BSONDocument factories & utilities.
BSONDocument factories & utilities.
reactivemongo.api.bson.BSONDocument("foo" -> 1, "bar" -> "lorem")
- object BSONDocumentHandler
BSONDocumentHandler factories
- object BSONDocumentReader
BSONDocumentReader factories
- object BSONDocumentWriter
BSONDocumentWriter factories.
- object BSONDouble
BSONDouble utilities
BSONDouble utilities
import reactivemongo.api.bson.BSONDouble BSONDouble(1.23D) match { case BSONDouble(v) => assert(v == 1.23D) case _ => ??? }
- implicit object BSONDoubleHandler extends BSONHandler[Double] with SafeBSONWriter[Double]
- Definition Classes
- DefaultBSONHandlers
- object BSONElement extends BSONElementLowPriority
BSONElement factories and utilities.
- implicit object BSONFloatHandler extends BSONHandler[Float] with SafeBSONWriter[Float]
- Definition Classes
- DefaultBSONHandlers
- object BSONHandler extends BSONHandlerInstances
BSONHandler factories
- object BSONInteger
BSONInteger factories & utilities
- implicit object BSONIntegerHandler extends BSONHandler[Int] with SafeBSONWriter[Int]
- Definition Classes
- DefaultBSONHandlers
- object BSONJavaScript
BSONJavaScript factories & utilities
- object BSONJavaScriptWS
BSONJavaScriptWS factories & utilities
- implicit object BSONLocalTimeHandler extends BSONHandler[LocalTime] with SafeBSONWriter[LocalTime]
- Definition Classes
- DefaultBSONHandlers
- implicit object BSONLocaleHandler extends BSONHandler[Locale] with SafeBSONWriter[Locale]
- Definition Classes
- DefaultBSONHandlers
- object BSONLong
BSONLong factories & utilities
- implicit object BSONLongHandler extends BSONHandler[Long] with SafeBSONWriter[Long]
- Definition Classes
- DefaultBSONHandlers
- object BSONMaxKey extends BSONMaxKey
- object BSONMinKey extends BSONMinKey
- object BSONNull extends BSONNull
- object BSONNumberLike
BSONNumberLike utilities
- object BSONObjectID
BSONObjectID utilities
- object BSONReader extends BSONReaderCompat with BSONReaderInstances
BSONReader factories
- object BSONRegex
BSONRegex factories & utilities
- implicit object BSONShortHandler extends BSONHandler[Short] with SafeBSONWriter[Short]
- Definition Classes
- DefaultBSONHandlers
- object BSONString
BSONString utilities
BSONString utilities
import reactivemongo.api.bson.BSONString BSONString("foo") match { case BSONString(v) => v == "foo" case _ => false }
- implicit object BSONStringHandler extends BSONHandler[String] with SafeBSONWriter[String]
- Definition Classes
- DefaultBSONHandlers
- object BSONSymbol
BSONSymbol factories & utilities
- object BSONTimestamp
Timestamp companion
- implicit object BSONURIHandler extends BSONHandler[URI] with SafeBSONWriter[URI]
- Definition Classes
- DefaultBSONHandlers
- implicit object BSONURLHandler extends BSONHandler[URL] with SafeBSONWriter[URL]
- Definition Classes
- DefaultBSONHandlers
- implicit object BSONUUIDHandler extends BSONHandler[UUID] with SafeBSONWriter[UUID]
- Definition Classes
- DefaultBSONHandlers
- object BSONUndefined extends BSONUndefined
Single value for BSONUndefined type
- object BSONValue extends BSONValueLowPriority1
BSONValue factories and utilities
- implicit object BSONValueIdentity extends bson.DefaultBSONHandlers.IdentityBSONHandler[BSONValue]
- Definition Classes
- BSONIdentityLowPriorityHandlers
- object BSONWriter extends BSONWriterCompat with BSONWriterInstances
BSONWriter factories.
- object DocumentClass
See DocumentClass
- object ElementProducer extends ElementProducerLowPriority1
- object FieldNaming
Naming companion
- object KeyReader
- object KeyWriter extends LowPriorityKeyWriter
KeyWriter factories
- object MacroConfiguration
MacroConfiguration factories and utilities
- object MacroOptions
MacroOptions factories & utilities.
- object Macros extends MacroAnnotations
Macros for generating
BSONReader
andBSONWriter
at compile time.Macros for generating
BSONReader
andBSONWriter
at compile time.import reactivemongo.api.bson.Macros case class Person(name: String, surname: String) implicit val personHandler = Macros.handler[Person]
- See also
MacroOptions for specific options
MacroConfiguration for extended configuration
- object Subtype
- object TypeNaming
TypeNaming factories
- object ¬
- Annotations
- @SuppressWarnings()