reactivemongo.play.json.compat

Members list

Concise view

Type members

Classlikes

Attributes

Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Self type
sealed trait FromValue

Conversion API from BSON to JSON values

Conversion API from BSON to JSON values

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object FromValue

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Implicit conversions for value types between play.api.libs.json and reactivemongo.api.bson, using lax conversions.

Implicit conversions for value types between play.api.libs.json and reactivemongo.api.bson, using lax conversions.

Attributes

Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Self type
sealed trait ToValue

Conversion API from BSON to JSON values

Conversion API from BSON to JSON values

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
FromValueAPI
object ToValue

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ToValue.type

See compat$ and ValueConverters.

Note that as there is not a JSON equivalent for each BSON value (BSONDateTime, or even distinction between BSON long/int).

So for example, using the default JSON handlers, a same Long property can be written in some documents as BSON long (NumberLong), and in some other as BSON integer (see ValueConverters.toNumber), which is ok to read all these documents, but can impact the MongoDB queries (same for date/time values that will be serialized as BSON string, rather than BSON date/time or timestamp).

Attributes

Companion:
trait
Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Self type

Implicit conversions for value types between play.api.libs.json and reactivemongo.api.bson.

Implicit conversions for value types between play.api.libs.json and reactivemongo.api.bson.

import play.api.libs.json.JsValue
import reactivemongo.api.bson.BSONValue
import reactivemongo.play.json.compat.ValueConverters._

def foo(v: BSONValue): JsValue =
 implicitly[JsValue](v) // ValueConverters.fromValue

def bar(v: JsValue): BSONValue =
 implicitly[BSONValue](v) // ValueConverters.toValue

''Note:'' Logger reactivemongo.api.play.json.ValueConverters can be used to debug.

Attributes

Companion:
object
Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Known subtypes
object ValueConverters.type
object extended

Attributes

Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Self type
object lax
import play.api.libs.json._
import reactivemongo.api.bson._
import reactivemongo.play.json.compat.lax._

Json.obj("_id" -> BSONObjectID.generate()) // objectIdWrites
// { "_id": "as_string_instead_of_ObjectId" }

Attributes

Graph
Supertypes
trait ToValue
trait FromValue
class Object
trait Matchable
class Any
Self type
lax.type

Value members

Concrete methods

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Any

Inherited fields

val JsFalse: JsFalse.type

Compatibility alias for play.api.libs.json.JsFalse (DO NOT USE)

Compatibility alias for play.api.libs.json.JsFalse (DO NOT USE)

Attributes

Inherited from:
PackageCompat (hidden)
val JsTrue: JsTrue.type

Compatibility alias for play.api.libs.json.JsTrue (DO NOT USE)

Compatibility alias for play.api.libs.json.JsTrue (DO NOT USE)

Attributes

Inherited from:
PackageCompat (hidden)