reactivemongo.play.json.compat.json2bson

Implicit conversions for handler types from play.api.libs.json to reactivemongo.api.bson .

import reactivemongo.play.json.compat.json2bson._

def foo[T](jw: play.api.libs.json.OWrites[T]) = {
 val w: reactivemongo.api.bson.BSONDocumentWriter[T] = jw
 w
}

'''Note:''' Importing both json2bson & bson2json can lead to diverging implicits in Scala 2.11 (see HandlerConverterSpec211).

Implicits

Inherited implicits

final implicit def toDocumentHandlerConv[T](h: OFormat[T])(implicit conv: FromValue): BSONDocumentHandler[T]

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.
 json2bson.toDocumentHandlerConv

def foo[T](jh: play.api.libs.json.OFormat[T]) = {
 val h: reactivemongo.api.bson.BSONDocumentHandler[T] = jh
 h
}
Inherited from:
Json2BsonConverters (hidden)
final implicit def toDocumentReader[T : DocumentClass](implicit evidence$1: DocumentClass[T], r: Reads[T], conv: FromValue): BSONDocumentReader[T]

Implicitly provides a BSON document reader if T is a case class, or a sealed trait (see DocumentClass).

Implicitly provides a BSON document reader if T is a case class, or a sealed trait (see DocumentClass).

Inherited from:
LowPriority2Json2BsonConverters (hidden)
final implicit def toDocumentReaderConv[T](r: Reads[T])(implicit conv: FromValue): BSONDocumentReader[T]

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.json2bson.toDocumentReaderConv

def lorem[T](jr: play.api.libs.json.Reads[T]) =
 toDocumentReaderConv(jr)
Inherited from:
LowPriority3Json2BsonConverters (hidden)
final implicit def toDocumentWriter[T](implicit w: OWrites[T], conv: ToValue): BSONDocumentWriter[T]

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.json2bson.toDocumentWriter

def foo[T : OWrites]: BSONDocumentWriter[T] =
 implicitly[BSONDocumentWriter[T]]
See also:

toDocumentWriterConv

Inherited from:
LowPriority1Json2BsonConverters (hidden)
final implicit def toDocumentWriterConv[T](w: OWrites[T])(implicit conv: ToValue): BSONDocumentWriter[T]
import reactivemongo.play.json.compat.
 json2bson.toDocumentWriterConv

def foo[T](jw: play.api.libs.json.OWrites[T]) = {
 val w: reactivemongo.api.bson.BSONDocumentWriter[T] = jw
 w
}
Inherited from:
LowPriority1Json2BsonConverters (hidden)
final implicit def toHandler[T](h: Format[T])(implicit from: FromValue, to: ToValue): BSONHandler[T]
Inherited from:
Json2BsonConverters (hidden)
final implicit def toReader[T](implicit r: Reads[T], conv: FromValue): BSONReader[T]

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.json2bson.toReader

def foo[T: Reads]: BSONReader[T] = implicitly[BSONReader[T]]
See also:

toDocumentWriterConv

Inherited from:
LowPriority3Json2BsonConverters (hidden)
final implicit def toReaderConv[T](r: Reads[T])(implicit conv: FromValue): 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.json2bson.toReaderConv

def foo[T](implicit r: Reads[T]): BSONReader[T] = r
See also:

toDocumentWriterConv

Inherited from:
LowPriority2Json2BsonConverters (hidden)
final implicit def toWriter[T](implicit w: Writes[T], conv: ToValue): BSONWriter[T]
import play.api.libs.json.JsValue
import reactivemongo.api.bson.BSONWriter

// Considering Writes[JsValue] provided by Play JSON,
// with compatibility ...
import reactivemongo.play.json.compat.json2bson._

def canResolve: BSONWriter[JsValue] = implicitly[BSONWriter[JsValue]]
Inherited from:
LowPriority3Json2BsonConverters (hidden)
final implicit def toWriterConv[T](w: Writes[T])(implicit conv: ToValue): BSONWriter[T]
Inherited from:
LowPriority3Json2BsonConverters (hidden)