Play! 2 Framework - Add Java Mongo driver

左心房为你撑大大i 提交于 2019-12-04 17:02:57
ndeverge

To add the MongoDB drivers to your Play project, edit your project/Build.scala file to add the MongoDB dependency:

val appDependencies = Seq(

   // ... here are your previous dependencies (derby etc...)
   "org.mongodb" % "mongo-java-driver" % "2.8.0"

) 

After you add this, you need to restart your Play server for the changes to take affect.

I use reactive-mongo for my project. You can find some information here http://reactivemongo.org/releases/0.10.5/documentation/tutorial/setup.html

In case the accepted answer doesn't work for some of you , you can try adding this version of mongodb in the build.sbt

"org.mongodb.morphia" % "morphia" % "0.107"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!