diff --git a/changelog.md b/changelog.md index 5bfed343..3a64469c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## 1.0.39 +## 1.0.39 & 1.0.40 Fix the ReactiveMongo module diff --git a/project/Acolyte.scala b/project/Acolyte.scala index 1bdc1095..2725b65e 100644 --- a/project/Acolyte.scala +++ b/project/Acolyte.scala @@ -21,7 +21,7 @@ object Acolyte extends Build with Dependencies with Format jdbcDriver, jdbcScala, jdbcClojure, studio). settings( organization in ThisBuild := "org.eu.acolyte", - version in ThisBuild := s"1.0.40${versionVariant}", + version in ThisBuild := s"1.0.41${versionVariant}", javaOptions in ThisBuild ++= Seq( "-source", javaVersion, "-target", javaVersion), scalaVersion in ThisBuild := "2.11.8", diff --git a/reactive-mongo/src/main/scala/Akka.scala b/reactive-mongo/src/main/scala/Akka.scala index e1124c96..eb09ac80 100644 --- a/reactive-mongo/src/main/scala/Akka.scala +++ b/reactive-mongo/src/main/scala/Akka.scala @@ -125,19 +125,26 @@ private[reactivemongo] class Actor(handler: ConnectionHandler) ) } - case _ ⇒ Try(handler.queryHandler(cid, req)) match { - case Failure(cause) ⇒ InvalidQueryHandler(cid, cause.getMessage) + case Request(coln, SimpleBody(ps)) ⇒ { + val qreq = new Request { + val collection = coln + val body = ps.collectFirst { + case ("$query", q @ BSONDocument(_)) ⇒ q + }.fold(req.body)(List(_)) + } + + Try(handler.queryHandler(cid, qreq)) match { + case Failure(cause) ⇒ InvalidQueryHandler(cid, cause.getMessage) - case Success(res) ⇒ res.fold( - NoQueryResponse(cid, msg.toString) - )(_ match { + case Success(res) ⇒ res.fold(NoQueryResponse(cid, msg.toString)) { case Success(r) ⇒ r case Failure(e) ⇒ MongoDB.QueryError(cid, Option(e.getMessage). getOrElse(e.getClass.getName)) match { case Success(err) ⇒ err case _ ⇒ MongoDB.MkQueryError(cid) } - }) + } + } } } diff --git a/reactive-mongo/src/test/scala/DriverSpec.scala b/reactive-mongo/src/test/scala/DriverSpec.scala index 9126435c..48cf8571 100644 --- a/reactive-mongo/src/test/scala/DriverSpec.scala +++ b/reactive-mongo/src/test/scala/DriverSpec.scala @@ -298,13 +298,15 @@ class DriverSpec extends org.specs2.mutable.Specification "as error when query handler returns no query result" in { implicit ee: EE ⇒ withFlatDriver { implicit drv: MongoDriver ⇒ - AcolyteDSL.withFlatQueryHandler( - { _: Request ⇒ QueryResponse.empty } - ) { con: MongoConnection ⇒ - AcolyteDSL.withFlatCollection(con, query3.collection) { - _.find(query3.body.head).cursor[BSONDocument]().collect[List]() - } + AcolyteDSL.withFlatQueryHandler({ + case Request("acolyte.test3", SimpleBody( + ("filter", BSONString("valC")) :: Nil)) ⇒ QueryResponse.empty + }) { con: MongoConnection ⇒ + AcolyteDSL.withFlatCollection(con, query3.collection) { + _.find(query3.body.head). + cursor[BSONDocument]().collect[List]() } + } }.map(_.isEmpty) aka "query result" must beTrue.await(0, timeout) } diff --git a/site.xml b/site.xml index 992dd81e..23914311 100644 --- a/site.xml +++ b/site.xml @@ -3,7 +3,7 @@ 4.0.0 org.eu.acolyte acolyte - 1.0.40 + 1.0.41 pom Acolyte diff --git a/studio/pom.xml b/studio/pom.xml index 4207f071..cad7d4b9 100644 --- a/studio/pom.xml +++ b/studio/pom.xml @@ -4,7 +4,7 @@ studio jar Acolyte Studio - 1.0.40 + 1.0.41 https://github.com/cchantep/acolyte/