我已经建立并创建了Playframework 2.8的新项目,我的难题是:
1。。我应该使用哪个依赖项:
"org.reactivemongo" %% "reactivemongo" % "1.0"
OR
"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
,所以我想和{ {1}}。
如您所见,我有点困惑,如果有人可以帮助我了解我应该使用哪种设置,以及哪种序列化/反序列化最适合使用它,我将不胜感激。谢谢!
答案 0 :(得分:0)
我会选择第一个选项,因为我的一些结果是不同集合的聚合/定制。因此,我将不得不自己编写自定义 BSON/JSON 转换器。