Skip to content

Commit

Permalink
Fix implicit ambiguity when compile for scala 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogdea committed Dec 27, 2019
1 parent dca5294 commit 49952af
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/org/nullvector/ReactiveMongoDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import reactivemongo.api.bson.BSONDocument
import reactivemongo.api.bson.collection.{BSONCollection, BSONSerializationPack}
import reactivemongo.api.commands.CommandError
import reactivemongo.api.indexes.{CollectionIndexesManager, Index, IndexType}
import reactivemongo.api.{DefaultDB, MongoConnection, MongoDriver}
import reactivemongo.api.{AsyncDriver, DefaultDB, MongoConnection, MongoDriver}

import scala.collection.mutable
import scala.concurrent.duration._
Expand All @@ -30,13 +30,13 @@ class ReactiveMongoDriver(system: ExtendedActorSystem) extends Extension {

private val database: DefaultDB = {
val mongoUri = system.settings.config.getString("akka-persistence-reactivemongo.mongo-uri")
val parsedUri = MongoConnection.parseURI(mongoUri) match {
val parsedUri: MongoConnection.ParsedURI = MongoConnection.parseURI(mongoUri) match {
case Success(_parsedURI) => _parsedURI
case Failure(exception) => throw exception
}
val databaseName = parsedUri.db.getOrElse(throw new Exception("Missing database name"))
Await.result(
MongoDriver(system.settings.config).connection(parsedUri, strictUri = false).get.database(databaseName),
AsyncDriver(system.settings.config).connect(parsedUri).flatMap(_.database(databaseName)),
30.seconds
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait ReactiveMongoAsyncReplay {
Fields.to_sn -> BSONDocument("$lte" -> toSequenceNr)
)
collection
.find(query, Option.empty)
.find(query, Option.empty[BSONDocument])
.sort(BSONDocument(Fields.to_sn -> 1))
.cursor[BSONDocument]()
.documentSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ trait PersistenceIdsQueries

private def buildFindAllIds(coll: collection.BSONCollection, offset: Offset): Source[PersistenceId, Future[State]] = {
coll
.find(BSONDocument(Fields.from_sn -> 1L) ++ filterByOffset(offset), None)
.find(BSONDocument(Fields.from_sn -> 1L) ++ filterByOffset(offset), Option.empty[BSONDocument])
.sort(BSONDocument("_id" -> 1))
.cursor[BSONDocument]()
.documentSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ReactiveMongoSnapshotImpl extends ReactiveMongoPlugin {
Fields.sequence -> BSONDocument("$lte" -> criteria.maxSequenceNr),
Fields.snapshot_ts -> BSONDocument("$gte" -> criteria.minTimestamp),
Fields.snapshot_ts -> BSONDocument("$lte" -> criteria.maxTimestamp),
), None).one[BSONDocument]
), Option.empty[BSONDocument]).one[BSONDocument]

maybeSelected <- maybeDoc.map { doc =>
val payloadDoc = (doc.getAsOpt[BSONDocument](Fields.payload), doc.getAsOpt[BSONDocument](Fields.snapshot_payload)) match {
Expand Down

0 comments on commit 49952af

Please sign in to comment.