Scala 不推荐使用ReactiveMongo中的find方法。0.20.3
我正在将反应式mongo 0.17.1-play26升级到0.20.3,但是,它给出了很多错误。我正在访问MongoDB以查找数据。它给了我上述的错误。plz帮助 这是我的陈述Scala 不推荐使用ReactiveMongo中的find方法。0.20.3,scala,reactivemongo,Scala,Reactivemongo,我正在将反应式mongo 0.17.1-play26升级到0.20.3,但是,它给出了很多错误。我正在访问MongoDB以查找数据。它给了我上述的错误。plz帮助 这是我的陈述 stdntcollection.find(query,Option(select)).cursor[studentDetails]().collect[List(-1,Cursor.FailOnError[List[studentDetails]]())` studentdetails是一个案例类。它们的结构像
stdntcollection.find(query,Option(select)).cursor[studentDetails]().collect[List(-1,Cursor.FailOnError[List[studentDetails]]())`
studentdetails是一个案例类。它们的结构像
case class studentDetails(
roll: Option[String],
subjct: String
)
object studentDetails {
implicit val studentDetailsReads: Reads[studentDetails] = (
(__ \ "roll").readNullable[String] and
(__ \ "subjct").read[String])(studentDetails.apply _)
implicit val studentDetailsWrites: Writes[studentDetails] = (
(__ \ "roll").writeNullable[String] and
(__ \ "subjct").write[String](unlift(studentDetails.unapply))
}
以下是错误:
方法find的参数不足:隐式swriter:stdntcollection.pack.Writer[play.api.libs.json.JsObject],隐式pwriter:stdntcollection.pack.Writer[scala.collection.Map[String,Int]]reactivemongo.api.collections.GenericQueryBuilder[stdntcollection.pack.type]。未指定值参数swriter,pwriter
我猜您使用的是带有JSON的集合,并且第二个参数selectyoupass缺少隐式。如图所示: 注1:studentDetails不遵守案例课程的要求 注2:JSONCollection可能会从1.0版中删除,新的转换提供了更简单的JSON支持
我猜您使用的是带有JSON的集合,并且第二个参数selectyoupass缺少隐式。如图所示: 注1:studentDetails不遵守案例课程的要求 注2:JSONCollection可能会从1.0版中删除,新的转换提供了更简单的JSON支持
请把你的问题格式化这是我的第一篇文章,我想说得更清楚请把你的问题格式化这是我的第一篇文章,我试图更清晰地理解包json中的包对象json已被弃用,因为0.19.2:将被reactivemongo.play.json.compat.替换为reactivemongo play json compatimport play.modules.reactivemongo.\u导入reactivemongo.play.json.\u导入reactivemongo.play.json.collection.\u导入play.api.libs.json.\u包json中的包对象json自0.19.2以来已弃用:将被替换为reactivemongo.play.json.compat.\u来自reactivemongo play json compatimport play.modules.reactivemongo.\u import reactivemongo.play.json.\u import reactivemongo.play.json.collection.\u import play.api.libs.json_
import reactivemongo.play.json._