Search code examples
mongodbscalaplayframework-2.3reactivemongoplay-reactivemongo

Difference between ReactiveMongo , Mongo-Module and MongoHelper


Mongo with Play-Framework is new for me. I have Spring-Framework background, In which we create Controller, Business and DAO layer structure applications. Now, i want to taste the flavor of Play-Framework with ReactiveMongo. For create our sample Application, my first target is to follow Controller, Business and DAO layer structure. Play-Framework already provide the basic structure of application, which is really good. If we use Mongodb with Play-Framework, I found three types of MongoDB Drivers. These are as below:

  1. Mongo Module (https://www.playframework.com/modules/mongo-1.1/home)
  2. MongoHelper (https://gist.github.com/harmeetsingh0013/fdc9c20b056a62f303f5)
  3. ReactiveMongo(http://reactivemongo.org/)

ReactiveMongo, which is really awesome for implementing non-blocking I/O. In reactive mongo there are some problem with sync the data from multiple queries. I have some queries for creating sample application as below:

  1. My first target is to implement MVC using ReactiveMongo, which i think ReactiveMongo-Extension provide me Dao layer. But i still want to confirm, ReactiveMongo-Extension is a good approach ? or I need to go for MongoHelper? What is the benefit of Mongo-Module over reactive mongo?
  2. For dependency Injection we need to go for Spring-Dependency Injection or Guice or other Scala Dependency Injection Framework ?
  3. If i am go for ReactiveMongo, we need to go for JSONCollection because BSONCollection is MongoDB Dependency. What is the support for JSONCollection available?

Solution

  • Current modules repository on playframework.com is just for Play 1.x. So Mongo Module is not an option for you.

    I am the author of ReactiveMongo-Extensions and it is highly inspired from MongoHelper. You can use which one you want. If you choose ReactiveMongo-Extensions JsonDao is your friend. There is also an example application which you can check out: https://github.com/mertkavi/play-reactivemongo-extensions-sample

    BTW I am currently developing a newer driver from scratch. You may also give it a try: https://github.com/fehmicansaglam/tepkin