2

On updating from "org.reactivemongo" %% "play2-reactivemongo" % "0.16.6-play26" to "org.reactivemongo" %% "play2-reactivemongo" % "0.20.3-play27" I get the following warnings which I'm not sure how to handle.

package object json in package json is deprecated (since 0.19.2): Will be replaced reactivemongo.play.json.compat._ from reactivemongo-play-json-compat

I can't see anything that should affect this in the Play Framework update (2.6.4 to 2.7.4). Thanks for any pointers!

  • That's not a change coming from Play. This change was introduced in reactivemongo. You would have to rewrite your code to use the new package / API to resolve the warnings. – cbley Feb 07 '20 at 07:41
  • Thanks @cbley. Any idea how? – jesus g_force Harris Feb 07 '20 at 12:24
  • Add the `reactivemongo-play-json-compat` library to your dependencies, and use `import reactivemongo.play.json.compat._` instead. Then, fix all compilation errors. – cbley Feb 07 '20 at 13:21
  • @cbley - fixes those warnings but creates another 20. Hard to believe that ReactiveMongoDB didn't make the upgrade smooth. – jesus g_force Harris Feb 08 '20 at 17:47
  • Ha. You don't know reactivemongo very well, do you?! BTW, we haven't yet switched to the new API; we are just living with those warnings. The new API might as well still change... The README says "These libraries are intended to replace (*at some point after release 1.0*) the BSON library currently shipped along with ReactiveMongo driver." which I interpret as it's not ready yet. At least, it is not very clear. – cbley Feb 10 '20 at 07:26
  • @cbley thanks for that. I guess we'll just have to wait for reactivemongo to get with it. Although there are other option. Have you had any experience with the [mongoDB native drivers](https://mongodb.github.io/mongo-scala-driver/)? – jesus g_force Harris Feb 13 '20 at 18:44
  • Our current setup is that we use the official scala mongo driver together with the (legacy) reactivemongo BSON library. The reason we switched was this: https://stackoverflow.com/questions/54706942/mongoerror-no-primary-node-is-available - but solely using the official mongo driver also for parsing BSON into model classes is a nightmare, not typesafe, and if you have an invalid model in your response you cannot skip over it. So we use the best of both worlds. – cbley Feb 14 '20 at 07:46

0 Answers0