Mongodb 2020年与ReactiveMongo(用于play framework应用程序)合作

Mongodb 2020年与ReactiveMongo(用于play framework应用程序)合作,mongodb,scala,reactivemongo,play-reactivemongo,Mongodb,Scala,Reactivemongo,Play Reactivemongo,我正在创建playframework 2.8的新项目,我的困境是: 1.我应该使用哪个依赖项: "org.reactivemongo" %% "reactivemongo" % "1.0" 或 2.到目前为止,我使用play json对插入或从mongo获取的对象进行序列化/反序列化,例如: object MongoSerializer { implicit val InstantFormat = CommonSerializer

我正在创建playframework 2.8的新项目,我的困境是:

1.我应该使用哪个依赖项:

"org.reactivemongo" %% "reactivemongo" % "1.0"

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


因此,正如您所看到的,我有点困惑,如果有人能帮助我了解我应该使用什么设置,以及哪种序列化/反序列化最适合我,我将不胜感激。谢谢

我将选择第一个选项,因为我的一些结果是不同集合的聚合/自定义。因此,我必须自己编写自定义BSON/JSON转换器。

我将选择第一个选项,因为我的一些结果是不同集合的聚合/自定义。因此,我必须自己编写自定义BSON/JSON转换器。

请先阅读@cchantep you right,我确实在文档上投入了更多时间,并发现它非常有用。我现在已经准备好了版本
“1.0.0-play28”
。谢谢。请先阅读@cchantep you right,我确实花了更多的时间在文档上,发现它非常有用。我现在已经准备好了版本
“1.0.0-play28”
。非常感谢。
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)
}