reactivemongo.play.json.compat
Type members
Classlikes
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.
See compat$ and ValueConverters.
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).
- Companion:
- class
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.
- Companion:
- object
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" }
Value members
Concrete methods
Inherited fields
Compatibility alias for play.api.libs.json.JsFalse
(DO NOT USE)
Compatibility alias for play.api.libs.json.JsFalse
(DO NOT USE)
- Inherited from:
- PackageCompat (hidden)