浏览代码

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 =>