fix reactivemongo deprecation warnings
This commit is contained in:
parent
7868793444
commit
81ab528c50
|
@ -1,6 +1,7 @@
|
|||
package lila.db
|
||||
|
||||
import reactivemongo.api._
|
||||
import reactivemongo.api.commands.GetLastError
|
||||
import reactivemongo.bson._
|
||||
|
||||
trait CollExt { self: dsl with QueryBuilderExt =>
|
||||
|
@ -91,14 +92,14 @@ trait CollExt { self: dsl with QueryBuilderExt =>
|
|||
def updateField[V: BSONValueWriter](selector: Bdoc, field: String, value: V) =
|
||||
coll.update(selector, $set(field -> value))
|
||||
|
||||
def updateFieldUnchecked[V: BSONValueWriter](selector: Bdoc, field: String, value: V) =
|
||||
coll.uncheckedUpdate(selector, $set(field -> value))
|
||||
def updateFieldUnchecked[V: BSONValueWriter](selector: Bdoc, field: String, value: V): Unit =
|
||||
coll.update(selector, $set(field -> value), writeConcern = GetLastError.Unacknowledged)
|
||||
|
||||
def incField(selector: Bdoc, field: String, value: Int = 1) =
|
||||
coll.update(selector, $inc(field -> value))
|
||||
|
||||
def incFieldUnchecked(selector: Bdoc, field: String, value: Int = 1) =
|
||||
coll.uncheckedUpdate(selector, $inc(field -> value))
|
||||
def incFieldUnchecked(selector: Bdoc, field: String, value: Int = 1): Unit =
|
||||
coll.update(selector, $inc(field -> value), writeConcern = GetLastError.Unacknowledged)
|
||||
|
||||
def unsetField(selector: Bdoc, field: String, multi: Boolean = false) =
|
||||
coll.update(selector, $unset(field), multi = multi)
|
||||
|
|
|
@ -5,6 +5,7 @@ import scala.util.Random
|
|||
import chess.format.{ Forsyth, FEN }
|
||||
import chess.{ Color, Status }
|
||||
import org.joda.time.DateTime
|
||||
import reactivemongo.api.commands.GetLastError
|
||||
import reactivemongo.api.{ CursorProducer, ReadPreference }
|
||||
import reactivemongo.bson.BSONBinary
|
||||
|
||||
|
@ -296,7 +297,7 @@ object GameRepo {
|
|||
coll.update($id(g.id), $doc("$unset" -> $doc(F.checkAt -> true)))
|
||||
|
||||
def unsetPlayingUids(g: Game): Unit =
|
||||
coll.uncheckedUpdate($id(g.id), $unset(F.playingUids))
|
||||
coll.update($id(g.id), $unset(F.playingUids), writeConcern = GetLastError.Unacknowledged)
|
||||
|
||||
// used to make a compound sparse index
|
||||
def setImportCreatedAt(g: Game) =
|
||||
|
|
|
@ -5,6 +5,7 @@ import scala.concurrent.duration._
|
|||
import actorApi._
|
||||
import akka.actor._
|
||||
import org.joda.time.DateTime
|
||||
import reactivemongo.api.commands.GetLastError
|
||||
import reactivemongo.bson._
|
||||
|
||||
import lila.db.BSON.BSONJodaDateTimeHandler
|
||||
|
@ -86,12 +87,12 @@ private[round] object History {
|
|||
case _ =>
|
||||
}
|
||||
|
||||
private def persist(coll: Coll, gameId: String)(vevs: List[VersionedEvent]) {
|
||||
if (vevs.nonEmpty) coll.uncheckedUpdate(
|
||||
private def persist(coll: Coll, gameId: String)(vevs: List[VersionedEvent]) =
|
||||
if (vevs.nonEmpty) coll.update(
|
||||
$doc("_id" -> gameId),
|
||||
$doc(
|
||||
"$set" -> $doc("e" -> vevs.reverse),
|
||||
"$setOnInsert" -> $doc("d" -> DateTime.now)),
|
||||
upsert = true)
|
||||
}
|
||||
upsert = true,
|
||||
writeConcern = GetLastError.Unacknowledged)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package lila.user
|
|||
import com.roundeights.hasher.Implicits._
|
||||
import org.joda.time.DateTime
|
||||
import reactivemongo.api._
|
||||
import reactivemongo.api.commands.GetLastError
|
||||
import reactivemongo.bson._
|
||||
|
||||
import lila.common.ApiVersion
|
||||
|
@ -116,7 +117,7 @@ object UserRepo {
|
|||
}
|
||||
|
||||
def incColor(userId: User.ID, value: Int): Unit =
|
||||
coll.uncheckedUpdate($id(userId), $inc(F.colorIt -> value))
|
||||
coll.update($id(userId), $inc(F.colorIt -> value), writeConcern = GetLastError.Unacknowledged)
|
||||
|
||||
val lichessId = "lichess"
|
||||
def lichess = byId(lichessId)
|
||||
|
|
Loading…
Reference in a new issue