-1

I have a following function that takes in an input JSON and validates it against a given JSON-Schema using the "com.eclipsesource" %% "play-json-schema-validator" % "0.6.2". This whole setup is working great until I have started getting warnings about a deprecated library. As you can see, I am using Ok(Json.toJson(result))) to convert result of type scala.List[BSONDocument] to JSON. This is done using the import play.modules.reactivemongo.json.BSONFormats._ library. I really like the easiness and simplicity of this conversion however, I am getting the following warning:

object BSONDocumentFormat in trait BSONFormats is deprecated: 0.11.9

And, here's my actual function:

def getMessage(campaignID: String, revision: Int, transactionID: Int ) = 
   Action.async { implicit request =>

  db.getDocument(campaignID, revision, transactionID)
  .map(result =>
  Ok(Json.toJson(result)))
  .recover {case ex: IOException => InternalServerError("Please install MongoDB")}

}

Is there an alternate way to do this? Why would the library developer remove such a useful functionality?

summerNight
  • 1,446
  • 3
  • 25
  • 52
  • 1
    If you have a look at the [deprecation message](https://github.com/ReactiveMongo/Play-ReactiveMongo/blob/master/src/main/scala/play/modules/reactivemongo/json.scala#L40), you could see that all the JSON serialization pack is moved out of the Play plugin, to be usable outside of a Play application. – cchantep Jan 20 '16 at 18:44
  • So I guess what you are suggesting me to use is `import reactivemongo.play.json.BSONFormats._` correct? – summerNight Jan 20 '16 at 19:10
  • I suggest you have a look at the doc: http://reactivemongo.org/releases/0.11/documentation/release-details.html – cchantep Jan 20 '16 at 19:17

1 Answers1

-1

As per @cchantep comments, I was able to resolve the issue by replacing:

import play.modules.reactivemongo.json.BSONFormats._

with:

import reactivemongo.play.json.BSONFormats._

summerNight
  • 1,446
  • 3
  • 25
  • 52
  • 2
    As suggested in the [documentation](http://reactivemongo.org/releases/0.11/documentation/json/overview.html), the import is `import reactivemongo.play.json._` – cchantep Jan 20 '16 at 19:36