Reactive Scala Driver for MongoDB
Asynchronous & Non-Blocking
Database and collections
Once you have a connection and resolved the database, the collections can be easily referenced.
By default, it returns a
BSONCollection, which implements the basic
Collection trait itself is almost empty, and is not meant to be used as is, as the operations are implemented by
If looking at the signature of the
DB.collection function, it can be seen that it uses a
CollectionProducer (resolved from the implicit scope. This producer is required to create the collection references.
By default the BSON producer is used, so there is nothing more to do.
This mechanism makes ReactiveMongo can support other kinds of serialization, such as the JSON support.
ReactiveMongo provides a helper to manage indexes (see
Many of these methods take documents as a parameters.
Indeed, they can take anything that can be represented as document, depending on the serialization pack (e.g. for the BSON one, any value for which is provided a
The results from the operations can be turned into the appropriate types, if there is a
BSONDocumentReader for this type in the implicit scope.