ReactiveMongo/Play-ReactiveMongo

self-type controllers.Users does not conform to play.modules.reactivemongo.MongoController's

Closed this issue · 3 comments

I am trying to create a play mongo app .I added "org.reactivemongo" %% "play2-reactivemongo" % "0.11.2.play24" and created a controller

class Users extends Controller with MongoController

But when I am trying to compile it shows

[error]  self-type controllers.Users does not conform to play.modules.reactivemongo.MongoController's selftype play.modules.rea
ctivemongo.MongoController with play.api.mvc.Controller with play.modules.reactivemongo.ReactiveMongoComponents
[error] class Users extends Controller with MongoController
[error]                                     ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 9 s, completed Dec 20, 2015 4:00:15 PM

Please try :

// ReactiveMongo Play2 plugin
import play.modules.reactivemongo.{ 
  MongoController,
  ReactiveMongoApi,
  ReactiveMongoComponents
}

class Users @Inject()(val reactiveMongoApi: ReactiveMongoApi) extends Controller with MongoController with ReactiveMongoComponents 

Thanks it compiled but can you explain why it wont work with my code , I am just a beginner with scala rectivemongo.

Hi, this issue tracker is for confirmed issue. Please use the MailingList for discussion (or to ask first if you're not sure). The document is available online. Best regards.