2015-10-29 97 views
-1

我與"org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play24"工作,當我編譯我的proyect,告訴我下一個錯誤:方法光標被棄用

[error] /home/hector/enova/play-silhouette-reactivemongo-seed-master/app/controllers/CourseController.scala:90: method cursor in trait GenericQueryBuilder is deprecated: Use [[cursor]] function with read preference. 
[error]  cursor[JsObject] 
[error]  ^
[error] /home/hector/enova/play-silhouette-reactivemongo-seed-master/app/controllers/CourseController.scala:120: method cursor in trait GenericQueryBuilder is deprecated: Use [[cursor]] function with read preference. 
[error]  cursor[JsObject] 
[error]  ^
[error] two errors found 
[error] (compile:compileIncremental) Compilation failed 

的線90和120都以粗體顯示:

val cursor: Cursor[JsObject] = collection. 
     find(Json.obj("title" -> title)). 
     sort(Json.obj("created" -> -1)).  
     cursor[JsObject] 


    val cursor: Cursor[JsObject] = collection. 
     find(Json.obj("active" -> true)). 
     cursor[JsObject] 

我該如何解決這個問題?

回答

1

只需在cursor方法中加上括號即可。這將是工作。

collection.find(...).cursor[JsObject]()