A BSONArray
(type 0x04
) is a indexed sequence of BSONValue.
A BSONArray
(type 0x04
) is a indexed sequence of BSONValue.
import reactivemongo.api.bson._ BSONArray(BSONString("foo"), BSONDouble(1.2D))
A BSON binary value.
BSON boolean value
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
BSON date time value
Value wrapper for a BSON 128-bit decimal.
A BSONDocument
structure (BSON type 0x03
).
A BSONDocument
structure (BSON type 0x03
).
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.
Convenient type alias for document handlers
A BSON Double.
A BSON Double.
reactivemongo.api.bson.BSONDouble(1.23D)
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"))
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
BSON Integer value
BSON JavaScript value.
BSON JavaScript value with scope (WS).
BSON Long value
BSON Max key value
BSON Min key value
BSON null value
A BSON value that can be seen as a number.
BSON ObjectId value.
BSON ObjectId value.
| Timestamp (seconds) | Machine identifier | Thread identifier | Increment | --- | --- | --- | --- | 4 bytes | 3 bytes | 2 bytes | 3 bytes
A reader that produces an instance of T
from a subtype of BSONValue.
BSON Regex value.
A BSON string.
A BSON string.
reactivemongo.api.bson.BSONString("foo")
BSON Symbol value.
BSON Timestamp value
BSON undefined value
A BSON value
A writer that produces a subtype of BSONValue from an instance of T
.
Naming strategy, to map each class property to the corresponding field.
Mapping from a BSON string to T
Mapping from a BSON string to T
Macro configuration
Macros with 'Opts' suffix will take additional options in the form of type parameters that will customize behaviour of the macros during compilation.
Binary Subtype
Naming strategy, to map each class to a discriminator value.
Type level evidence that type A
is not type B
.
Type level evidence that type A
is not type B
.
Utility functions
See BSONArray
BSONDocument factories & utilities
Handler factory
BSONDouble factories
BSONReader factories
BSONString factories
Timestamp companion
BSONValue factories and utilities
Naming companion
Macros for generating BSONReader
and BSONWriter
at compile time.
Macros for generating BSONReader
and BSONWriter
at compile time.
import reactivemongo.api.bson.Macros case class Person(name: String, surname: String) implicit val personHandler = Macros.handler[Person]
MacroConfiguration for extended configuration
MacroOptions for specific options
Returns an array with given values.
Returns an array with given values.
import reactivemongo.api.bson._ val arr = array("bar", 1L) // [ 'bar', NumberLong(1) ]
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' ]
Returns a BSON handler for java.time.LocalDate
,
considering the specified time zone
.
Returns a BSON handler for java.time.LocalDate
,
considering the specified time zone
.
Returns a BSON handler for java.time.LocalDateTime
,
considering the specified time zone
.
Returns a BSON handler for java.time.LocalDateTime
,
considering the specified time zone
.
Returns a BSON handler for java.time.OffsetDateTime
,
considering the specified time zone
.
Returns a BSON handler for java.time.OffsetDateTime
,
considering the specified time zone
.
Returns a BSON handler for java.time.ZonedDateTime
,
considering the specified time zone
.
Returns a BSON handler for java.time.ZonedDateTime
,
considering the specified time zone
.
Returns a document with given elements.
Returns a document with given elements.
import reactivemongo.api.bson._ val doc = document("foo" -> 1) // { 'foo': 1 }
Returns an empty document.
Returns an empty document.
import reactivemongo.api.bson._ val doc = document ++ ("foo" -> 1) // { 'foo': 1 }
Returns a newly generated object ID.