Skip to content

Instantly share code, notes, and snippets.

@NicolaeNMV
Created January 10, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicolaeNMV/80e8edc1682e1b01ffcd to your computer and use it in GitHub Desktop.
Save NicolaeNMV/80e8edc1682e1b01ffcd to your computer and use it in GitHub Desktop.
Solve ReactiveMongo playframework scala "No implicit format for reactivemongo.bson.BSONObjectID available."
import play.api.libs.json.{Json, Format}
// If you imported
import play.modules.reactivemongo.json.BSONFormats.BSONObjectIDFormat
// And still getting No implicit format for reactivemongo.bson.BSONObjectID available. error
// Check that your JSON formatter is typed. Change
implicit val mongoFormat = Json.format[Category]
// to
implicit val mongoFormat: Format[Category] = Json.format[Category]
// This seem to help scala compiler to find all the implicit types
@RezaBidar
Copy link

RezaBidar commented Nov 16, 2017

import reactivemongo.play.json._
import reactivemongo.play.json.collection.JSONCollection
import play.api.libs.json._

implicit val mongoFormat: OFormat[Category] = Json.format[Category]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment