简体   繁体   中英

MongoDB with Play Framework using Java

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).

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

You can use PlayJongo Play 2.4.x Module .

It is a Play 2.4.x Module for Jongo (a MongoDB Java driver wrapper).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM