【发布时间】:2020-11-12 13:10:41
【问题描述】:
我已经建立了 playframework 2.8 的新项目,我的困境是:
1.我应该使用哪个依赖:
"org.reactivemongo" %% "reactivemongo" % "1.0"
或
"org.reactivemongo" %% "play2-reactivemongo" // dont even think that there is 1.0 for play 2.8, is it deprecated?
2. 到目前为止,我使用 play-json 来序列化/反序列化我插入或从 mongo 获取的对象,例如:
object MongoSerializer {
implicit val InstantFormat = CommonSerializers.InstantSerializers.BSONFormat
implicit val MetadataFormat: OFormat[Metadata] = Json.format[Metadata]
implicit val PairingFormat: OFormat[Pairing] = Json.format[Pairing]
implicit val pairTypeFormat: Format[PairType] = EnumFormats.formats(PairType)
}
在我的 dbconfig 中我使用了 _.collection[JSONCollection],但我记得有人写道 JSONCollection 即将被弃用,并且将仅支持 BSONCollection 所以我想使用 BSONCollection。
如您所见,我有点困惑,如果有人可以帮助我了解我应该使用什么设置以及哪种序列化/反序列化最适合它,我将不胜感激。谢谢!
【问题讨论】:
-
请先阅读documentation
-
@cchantep 你说得对,我确实在文档上投入了更多时间,发现它很有帮助。我现在已经准备好使用版本
"1.0.0-play28"。谢谢。
标签: mongodb scala reactivemongo play-reactivemongo