简体   繁体   中英

Working with ReactiveMongo (for play framework apps) in 2020

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM