我正在将游戏从2.4.3升级到2.5.2我能够升级游戏但是当我将反应性mongo库依赖从0.11.0.play24升级到0.11.14-play24时抛出以下错误
found : (String, play.api.libs.json.JsValue)
[error] required: reactivemongo.bson.Producer[reactivemongo.bson.BSONElement]
[error] (which expands to) reactivemongo.bson.Producer[(String, reactivemongo.bson.BSONValue)]
[error] Error occurred in an application involving default arguments.
[error] claimsCollection.update(BSONDocument("id" -> claimId), BSONDocument("$set" -> BSONDocument("status"-> "Approved" , "updationDate" -> Json.toJson(ZonedDateTime.now()))))
[error]
我写的代码
import com.greenroom6.auth.models.claims.Claims
import javax.inject.Inject
import play.modules.reactivemongo.ReactiveMongoApi
import play.modules.reactivemongo.json.collection.JSONCollection
import scala.concurrent.ExecutionContext
import com.greenroom6.auth.util.UniqueIdGenerator
import reactivemongo.bson.BSONDocument
import play.api.libs.json.{Json,JsObject}
import play.modules.reactivemongo.json._
import scala.concurrent.Future
import reactivemongo.api.commands.WriteResult
import reactivemongo.api.ReadPreference
import java.time.ZonedDateTime
import play.modules.reactivemongo.json._,ImplicitBSONHandlers._
import reactivemongo.bson._
import play.modules.reactivemongo.ReactiveMongoComponents
class ClaimsDaoImpl @Inject()(reactivemongo : ReactiveMongoApi) extends ClaimsDao {
protected def claimsCollection = reactivemongo.db.collection[JSONCollection]("claims")
def claimProfile(claim:Claims)(implicit ec :ExecutionContext): Future[WriteResult] = {
val claimTosave = claim.copy(id = Some(UniqueIdGenerator.generate), status = "Pending" )
claimsCollection.save(claimTosave)
}
def approveClaim(claimId:String)(implicit ec :ExecutionContext): Future[WriteResult] = {
claimsCollection.update(BSONDocument("id" -> claimId), BSONDocument("$set" -> BSONDocument("status"-> "Approved" , "updationDate" -> Json.toJson(ZonedDateTime.now()))))
}
}
我应该怎么做才能解决问题?
答案 0 :(得分:0)
我认为你有错误的依赖。根据他们的Github页面:ReactiveMongo/Play-ReactiveMongo
val reactiveMongoVer = "0.11.14"
// only for Play 2.5.x
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % reactiveMongoVer
)
相反,你似乎使用了这个:
// only for Play 2.4.x
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % s"$reactiveMongoVer-play24"
)