Przeglądaj źródła

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

... reduces unnecessary list processing and cursor creation.
Skamander 12 lat temu
rodzic
commit
1f918d7a7d

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

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