reactivemongo.play.json.compat
Implicit conversion from new BSONDocumentHandler
to Play JSON.
Implicit conversion from new BSONDocumentHandler
to Play JSON.
import reactivemongo.play.json.compat.HandlerConverters.fromDocumentHandler def bar[T](bh: reactivemongo.api.bson.BSONDocumentHandler[T]) = { val h: play.api.libs.json.OFormat[T] = bh h }
import reactivemongo.play.json.compat.HandlerConverters.fromDocumentWriter def bar[T](lw: reactivemongo.api.bson.BSONDocumentWriter[T]) = { val w: play.api.libs.json.OWrites[T] = lw w }
Provided there is a BSON reader, a JSON one is resolved.
Provided there is a BSON reader, a JSON one is resolved.
import play.api.libs.json.Reads import reactivemongo.api.bson.BSONReader import reactivemongo.play.json.compat.fromReader def foo[T: BSONReader]: Reads[T] = implicitly[Reads[T]]
Based on the compatibility conversions,
provides instances of Play JSON Reads
for the new BSON value API.
Based on the compatibility conversions,
provides instances of Play JSON OWrites
for the new BSON value API.
Based on the compatibility conversions,
provides instances of Play JSON Writes
for the new BSON value API.
Based on the compatibility conversions,
provides instances of Play JSON Writes
for the new BSON value API.
import play.api.libs.json.Writes import reactivemongo.api.bson.BSONObjectID import reactivemongo.play.json.compat.jsonWriterNewValue val w = implicitly[Writes[BSONObjectID]]
Implicit conversion from Play JSON OFormat
to the BSON API.
Implicit conversion from Play JSON OFormat
to the BSON API.
import reactivemongo.play.json.compat.HandlerConverters.toDocumentHandler def foo[T](jh: play.api.libs.json.OFormat[T]) = { val h: reactivemongo.api.bson.BSONDocumentHandler[T] = jh h }
Raises a JsError
is the JSON value is not a JsObject
.
Raises a JsError
is the JSON value is not a JsObject
.
import reactivemongo.play.json.compat.toDocumentReaderConv def lorem[T](jr: play.api.libs.json.Reads[T]) = toDocumentReaderConv(jr)
Provided there is a Play JSON OWrites
, resolve a document writer.
Provided there is a Play JSON OWrites
, resolve a document writer.
import play.api.libs.json.OWrites import reactivemongo.api.bson.BSONDocumentWriter import reactivemongo.play.json.compat.toDocumentWriter def foo[T : OWrites]: BSONDocumentWriter[T] = implicitly[BSONDocumentWriter[T]]
import reactivemongo.play.json.compat.HandlerConverters.toDocumentWriterConv def foo[T](jw: play.api.libs.json.OWrites[T]) = { val w: reactivemongo.api.bson.BSONDocumentWriter[T] = jw w }
Provided there is a Play JSON Reads
, resolve a BSON reader.
Provided there is a Play JSON Reads
, resolve a BSON reader.
import play.api.libs.json.Reads import reactivemongo.api.bson.BSONReader import reactivemongo.play.json.compat.toReader def foo[T: Reads]: BSONReader[T] = implicitly[BSONReader[T]]
Converts a Play JSON Reads
to a BSON reader.
Converts a Play JSON Reads
to a BSON reader.
import play.api.libs.json.Reads import reactivemongo.api.bson.BSONReader import reactivemongo.play.json.compat.toReaderConv def foo[T](implicit r: Reads[T]): BSONReader[T] = r
Implicit conversions for handler types between
play.api.libs.json
andreactivemongo.api.bson
.Note: Logger
reactivemongo.api.play.json.HandlerConverters
can be used to debug.