Working with ReactiveMongo (for play framework apps) in 2020

245 Views Asked by At

I'v set up and new project of playframework 2.8, and my dilemmas are:

1. which dependency should I use:

"org.reactivemongo" %% "reactivemongo" % "1.0"

OR

  "org.reactivemongo" %% "play2-reactivemongo" // dont even think that there is 1.0 for play 2.8, is it deprecated?

2. up until now I used play-json for serialize/deserialize my objects that I insets or fetch from mongo, for example:

object MongoSerializer {
  implicit val InstantFormat = CommonSerializers.InstantSerializers.BSONFormat
  implicit val MetadataFormat: OFormat[Metadata] = Json.format[Metadata]
  implicit val PairingFormat: OFormat[Pairing] = Json.format[Pairing]
  implicit val pairTypeFormat: Format[PairType] = EnumFormats.formats(PairType)
}

and in my dbconfig I used _.collection[JSONCollection], but I remember someone wrote that JSONCollection is about to be deprecated and there will be only support for BSONCollection so I wanted to work with BSONCollection.

so as you can see I'm a bit confused, if there is someone who can help me understand what setup should I use and which serialize/deserialize will go best with it I will appreciate it allot. thanks!

1

There are 1 best solutions below

0
Joseph Hui On

I will go for the first option because some of my result is an aggregation/customization of different collections. Thus, I will have to write custom BSON/JSON converters myself.