Reactive Scala Driver for MongoDB
Asynchronous & Non-Blocking
Setup your project
We assume that you got a running MongoDB instance. If not, get the latest MongoDB binaries and unzip the archive. Then you can launch the database:
This will start a standalone MongoDB instance that stores its data in the
data directory and listens on the TCP port 27017.
Set up your project dependencies
ReactiveMongo is available on Maven Central.
Using SBT, you just have to edit
build.sbt and add the driver dependency:
Or if you want to be on the bleeding edge using snapshots:
ReactiveMongo is internally using Akka, so it declares a transitive dependency to.
If your project already has the Akka dependency, directly or transitively (e.g. by Play dependencies), both must be compatible.
ReactiveMongo is tested against Akka from version 2.3.13 up to 2.4.x (2.4.8 for now).
SLF4J is now used by the ReactiveMongo logging, so a SLF4J binding must be provided (e.g. slf4j-simple).
In a Play application, the Play Framework logging will be used.
Example of logging configuration with the Logback binding:
NoClassDefFoundError: : org/slf4j/LoggerFactory
Log4J is still required for backward compatibility (by deprecated code). If you see the following message, please make sure you have a Log4J framework available.
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.