Browse Source

Updated to Play 2.2.0 along with 2.2.0 conventions

Christopher Hunt 11 years ago
parent
commit
385b1cea14

+ 11 - 13
play-scala-mongodb/app/controllers/Application.scala

@@ -33,21 +33,19 @@ object Application extends Controller {
   private def collection: JSONCollection = database.collection[JSONCollection]("world")
   private def collection: JSONCollection = database.collection[JSONCollection]("world")
   private val projection = Json.obj("_id" -> 0)
   private val projection = Json.obj("_id" -> 0)
 
 
-  def db(queries: Int) = Action {
+  def db(queries: Int) = Action.async {
     import scala.concurrent.ExecutionContext.Implicits.global
     import scala.concurrent.ExecutionContext.Implicits.global
 
 
-    Async {
-      val random = ThreadLocalRandom.current()
-      val futureWorlds = Future.sequence((for {
-        _ <- 1 to queries
-      } yield { collection
-        .find(Json.obj("id" -> (random.nextInt(TestDatabaseRows) + 1)), projection)
-        .one[JsValue]
-      }))
-
-      futureWorlds.map { worlds =>
-        Ok(Json.toJson(worlds))
-      }
+    val random = ThreadLocalRandom.current()
+    val futureWorlds = Future.sequence((for {
+      _ <- 1 to queries
+    } yield { collection
+      .find(Json.obj("id" -> (random.nextInt(TestDatabaseRows) + 1)), projection)
+      .one[JsValue]
+    }))
+
+    futureWorlds.map { worlds =>
+      Ok(Json.toJson(worlds))
     }
     }
   }
   }
 
 

+ 1 - 1
play-scala-mongodb/project/Build.scala

@@ -7,7 +7,7 @@ object ApplicationBuild extends Build {
   val appVersion      = "1.0-SNAPSHOT"
   val appVersion      = "1.0-SNAPSHOT"
 
 
   val appDependencies = Seq(
   val appDependencies = Seq(
-    "org.reactivemongo" %% "play2-reactivemongo" % "0.9"
+    "org.reactivemongo" %% "play2-reactivemongo" % "0.9" exclude("org.scala-stm", "scala-stm_2.10.0")
   )
   )
 
 
   val main = play.Project(appName, appVersion, appDependencies).settings(
   val main = play.Project(appName, appVersion, appDependencies).settings(

+ 1 - 1
play-scala-mongodb/project/build.properties

@@ -1 +1 @@
-sbt.version=0.12.3
+sbt.version=0.13.0

+ 1 - 1
play-scala-mongodb/project/plugins.sbt

@@ -5,4 +5,4 @@ logLevel := Level.Warn
 resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
 resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
 
 
 // Use the Play sbt plugin for Play projects
 // Use the Play sbt plugin for Play projects
-addSbtPlugin("play" % "sbt-plugin" % "2.1.2-RC1")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")