I'm new to Play framework. I'm trying to configure MongoDB database as a datasource to be used with Play framework 2.4. But I am unable to find any tutorial or steps which can guide me to have connection of my "Hello world" application with mongoDB. I just need to know how can I use mongoDB with the current play version? Just need to understand the basic CRUD operations b/w mongodb and play framework using java (not scala).
MongoDB with Play Framework using Java
6.8k views Asked by Prashant Agarwal At
2
There are 2 answers
0
On
You can use PlayJongo Play 2.4.x Module.
It is a Play 2.4.x Module for Jongo (a MongoDB Java driver wrapper).
see this answer https://stackoverflow.com/a/11754368/5034081
it explains how to add the java driver for your application. but you have to be careful because interacting with database is a blocking action and if you block your threads you will have troubles. read the official doc on how to solve this problem. https://www.playframework.com/documentation/2.1.0/ThreadPools
there is also other libs like this for using mongo in a play application. https://github.com/vznet/play-mongo-jackson-mapper