فهرست منبع

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

... reduces unnecessary list processing and cursor creation.
Skamander 12 سال پیش
والد
کامیت
9ed2ff1d43
1فایلهای تغییر یافته به همراه1 افزوده شده و 2 حذف شده
  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
       } yield { collection
         .find(Json.obj("id" -> (random.nextInt(TestDatabaseRows) + 1)), projection)
-        .cursor[JsValue]
-        .toList.map(list => list.head)
+        .one[JsValue]
       }))
 
       futureWorlds.map { worlds =>