ReactiveMongo Biːsən

BSON libraries for ReactiveMongo

Motivation

These libraries are intended to replace (at some point after release 1.0) the BSON library currently shipped along with ReactiveMongo driver.

It will fix some issues, bring multiple API and performance improvements (simpler & better).

Usage

The main API library migrates both the BSON values types (with same names; see example) and the handler typeclasses (reader/writer; see example).

Note: The package of the new library is reactivemongo.api.bson (instead of reactivemongo.bson).

It can already be used in your build.sbt:

libraryDependencies += "org.reactivemongo" %% "reactivemongo-bson-api" % VERSION)

Maven Javadocs

import reactivemongo.api.bson._

This refactoring also includes the following optional libraries.

compat:

The compatibility library, that provides conversions between the previous and the new APIs. It can be configured in the build.sbt as below.

libraryDependencies += "org.reactivemongo" %% "reactivemongo-bson-compat" % VERSION

Then the conversions can be imported:

import reactivemongo.api.bson.compat._

msb-compat:

The compatiblity library for org.bson, that provides conversions between this package and the new BSON API. It can be configured in the build.sbt as below.

libraryDependencies += "org.reactivemongo" %% "reactivemongo-bson-msb-compat" % VERSION

Then the conversions can be imported:

import reactivemongo.api.bson.msb._

geo:

The GeoJSON library, that provides the geometry types and the handlers to read from and write to appropriate BSON representation.

It can be configured in the build.sbt as below.

libraryDependencies += "org.reactivemongo" %% "reactivemongo-bson-geo" % VERSION

specs2:

The Specs2 library provides utilities to write tests using specs2 with BSON values.

It can be configured in the build.sbt as below.

libraryDependencies += "org.reactivemongo" %% "reactivemongo-specs2" % VERSION
import reactivemongo.api.bson.BSONDocument
import reactivemongo.api.bson.specs2._

final class MySpec extends org.specs2.mutable.Specification {
  "Foo" title

  "Bar" should {
    "lorem" in {
      BSONDocument("ipsum" -> 1) must_=== BSONDocument("dolor" -> 2)
      // Use provided Diffable to display difference
      // between actual and expected documents
    }
  }
}

monocle: EXPERIMENTAL

The library that provides Monocle utilities for BSON values. It can be configured in the build.sbt as below.

libraryDependencies += "org.reactivemongo" %% "reactivemongo-bson-monocle" % VERSION

Then the utilities can be imported:

import reactivemongo.api.bson.monocle._

Build manually

ReactiveMongo BSON libraries can be built from this source repository.

sbt publishLocal

To run the tests, use:

sbt test

Travis: Travis build status