问题描述
在引用"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"
当我更新对"org.reactivemongo" % "play2-reactivemongo_2.11" % "0.11.0.play23-M3"
的引用时,我得到:
when I update the reference to "org.reactivemongo" % "play2-reactivemongo_2.11" % "0.11.0.play23-M3"
I get:
import org.joda.time.DateTime
import reactivemongo.bson.BSONObjectID
import play.modules.reactivemongo.json.BSONFormats._
case class GoogleToken
(
id: Option[BSONObjectID],
name: String,
emailAddress: String,
refreshToken: String,
expires: DateTime
)
object GoogleToken {
import play.api.libs.json.Json
// Generates Writes and Reads
implicit val googleTokenFormat = Json.format[GoogleToken]
}
然后
val collection = db.collectionJSONCollection
val collection = db.collectionJSONCollection
val query = Json.obj()
val cursor = collection.find(query).
cursor[GoogleToken](ReadPreference.nearest).
collect[List]()
我在做什么错了?
推荐答案
ReactiveMongo 0.11的最终版本已发布("org.reactivemongo" %% "play2-reactivemongo" % "0.11.0.play23"
).
The final release of ReactiveMongo 0.11 has been published ("org.reactivemongo" %% "play2-reactivemongo" % "0.11.0.play23"
).
如更新的文档所述,对于默认的BSON/JSON转换,建议使用拥有:import play.modules.reactivemongo.json._, ImplicitBSONHandlers._
.
As indicated on the updated documentation, for the default BSON/JSON conversions, it's recommended to have: import play.modules.reactivemongo.json._, ImplicitBSONHandlers._
.
这篇关于没有找到play.api.libs.json.JsObject类型的Json序列化程序作为JsObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!