Reactive Scala Driver for MongoDB

Asynchronous & Non-Blocking

Overview of the ReactiveMongo BSON library

The BSON library of ReactiveMongo implements the BSON protocol, or Binary JSON, which is used by MongoDB to encode data. Because of that, when we use MongoDB we tend to manipulate a lot of BSON structures; thus the BSON library is designed with the following points in mind:

Documents and values

There is one Scala class for each BSON type, all in the reactivemongo.bson package:

All these classes extend BSONValue.

A document is represented by BSONDocument. A BSONDocument is basically an immutable list of key-value pairs. Since it is the most used BSON type, one of the main focuses of the ReactiveMongo BSON library is to make manipulations of BSONDocument as easy as possible.

Furthermore, the whole library is articulated around the concept of BSONDocumentWriter and BSONDocumentReader. These are type classes which purpose is to serialize/deserialize objects of arbitrary types into/from BSON. This makes usage of MongoDB much less verbose and more natural.

Next: Using the ReactiveMongo BSON library