Browse Source

Changed the query from cursor to one, which ...

... reduces unnecessary list processing and cursor creation.
Skamander 12 years ago
parent
commit
9ed2ff1d43
1 changed files with 1 additions and 2 deletions
  1. 1 2
      play-scala-mongodb/app/controllers/Application.scala

+ 1 - 2
play-scala-mongodb/app/controllers/Application.scala

@@ -42,8 +42,7 @@ object Application extends Controller {
         _ <- 1 to queries
         _ <- 1 to queries
       } yield { collection
       } yield { collection
         .find(Json.obj("id" -> (random.nextInt(TestDatabaseRows) + 1)), projection)
         .find(Json.obj("id" -> (random.nextInt(TestDatabaseRows) + 1)), projection)
-        .cursor[JsValue]
-        .toList.map(list => list.head)
+        .one[JsValue]
       }))
       }))
 
 
       futureWorlds.map { worlds =>
       futureWorlds.map { worlds =>