MongoFormats

uk.gov.hmrc.mongo.play.json.formats.MongoFormats
See theMongoFormats companion object
trait MongoFormats

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MongoFormats
Self type

Members list

Type members

Classlikes

object Implicits extends Implicits

Attributes

Companion
trait
Supertypes
trait Implicits
class Object
trait Matchable
class Any
Self type
Implicits.type
trait Implicits

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Implicits

Value members

Deprecated methods

def mongoEntity[A](baseFormat: Format[A]): Format[A]

Maps a Format for an entity with 'id' field to mongo by renaming the id field to internal '_id'. Useful for auto generated Formats, where the model id key is named 'id'.

Maps a Format for an entity with 'id' field to mongo by renaming the id field to internal '_id'. Useful for auto generated Formats, where the model id key is named 'id'.

case class MyObject(id: ObjectId)
val formats: Format[MyObject] = mongoEntity(Json.format[MyObject]}

This is deprecated since an explicit Format, mapping id to _id is preferred. Also any queries on id would still need to use the underlying '_id' name.

Attributes

Deprecated
true

Concrete fields

final val objectIdFormat: Format[ObjectId]
final val objectIdReads: Reads[ObjectId]
final val objectIdWrites: Writes[ObjectId]