Play 2 Ebean with MongoDB - mongodb

When I try to use MongoDB driver in my play framework application's application.conf as
db.default.driver=com.mongodb
I am getting Driver not found error. I have configured dependency in Build.scala for MongoDB driver.
I am using official Java driver for MongoDB mongo-java-driver v 2.11.1. I want this driver to be used with Ebean.
What is the correct class name to be used in the db.default.driver to get this working?

EBean doesn't support MongoDB, it only works with relational databases as it is a JPA-compliant driver.
Here you have an example using Java and MongoDB which may help you to bootstrap your project

Click [here](https://github.com/ReactiveMongo/Play-ReactiveMongo"ReactiveMongo Support to Play! Framework 2.3")!
This is a plugin for Play 2.3, enabling support for ReactiveMongo - reactive, asynchronous and non-blocking Scala driver for MongoDB.
ReactiveMongo is a scala driver that provides fully non-blocking and asynchronous I/O operations.
ReactiveMongo-link ReactiveMongo

Related

Does spark-cassandra-connector support built-in load balanceing?

I have Scala-based application and I need to connect it to Cassandra.
I found DataStax Enterprise drivers very useful in this regard, and those have a lot of cool features like in-built load balancing for Cassandra and that is really import for me.
Unfortunately there isn't any native DSE drivers for Scala. I know we can use DSE Java drivers, but in that case, we loose a lot of Scala cool features.
I also found spark-cassandra-connector that's built by Datastax as well, but this built-in load balancing thing is really important to me and I don't know if spark-cassandra-connector support it or not.
In the Java-based applications using DSE Java driver, I need to config the built-in load balancer in a configuration file as below:
datastax-java-driver.basic.load-balancing-policy {
class = DefaultLoadBalancingPolicy
}
I don't know the equivalent way in Scala using spark-cassandra-connector and I'm not even sure if it is possible or not.
Any help would be appreciated. Thanks.
In the Scala you can just use the Java driver - out of the box you don't have only support for base Scala types, but you can solve this problem by importing the java-driver-scala-extras into your project (as source code) - it works for at least for driver 3.x. Another issue is the support for Option, but this could done via Java's optional that has an extra codec in Java driver.
Regarding the customization of the driver - that part should work with Scala without change. Regarding the support of default policy in Spark - Spark Cassandra connector has a separate policy for a special reason - it's close to the Java's default policy, but with specifics for Spark.

sync mongodb with elasticsearch scala environment

Im using reactive mongo as my mongodb(v3.4) driver in my play 2.6 application.
Does someone have a recommended way to sync every insert/update I have with my elasticsearch(v5.6)?

MongoDB NodeJS or Java Driver

I'm using the MongoDB Java Driver. I have many requests and it is limited by this driver, requesting 1 at a time.
I want to perform async requests to MongoDB. Hence there is a need to change my program to either an MongoDB Async Java Driver OR use a MongoDB NodeJS Driver.
Which do you recommend? My app deals with a lot of JSON objects. I am fluent in both Java and Javascript :)
Thank you in advance!

Use MongoDB Java Driver CommandListener directly from Core?

I'm using Vert.x MongoDB Client which is built on the MongoDB Java Client Core lib. I'd like to use a CommandListener (which is part of Core) however it's not clear if
it's possible to use the CommandListener directly from Core, and
how to register the listener if it is possible
Any pointers are greatly appreciated.

Using Cassandra and MySQL together with JPA in Play framework

I would like to use Cassandra NoSQL server with an RDBMS in Play 2.3.0!
Started to build it up using Kundera, according to this tutorial:
http://recipes4geeks.com/2013/07/06/play-nosql-building-nosql-applications-with-play-framework/
It works fine, and I can use it with pure mysql-jdbc connection, and it also works if I use jdbc for Cassandra connection and JPA for MySQL..
.. but the goal is to use a persistence framework, without handling basic JDBC stuffs!
It looks, this problem was mentioned in the link above:
Caution: javaJdbc app dependency downloads hibernate-entitymanager jar file that interferes with Kundera. Make sure you remove this app dependency which is by default present.
If I remove the hibernate-entitymanager from the dependencies, the project runs, but when it wants to call the Persistence.createEntityManagerFactory("mysql") method, Play says: No Persistence provider... as it was expected.
If I keep the hibernate-entitymanager in the dependencies list, beside the kundera client, the Play server simply shuts down.
Is there a possibility to make it work or I have to replace Kundera?
DataNucleus JPA supports persistence to all RDBMS around (via JDBC), as well as to Cassandra, MongoDB, Neo4j, LDAP, HBase and many others. It's Cassandra support seems to be for all latest versions and uses the native Cassandra driver (not JDBC) and so no chance of conflicts like above. You can read up on it at
http://www.datanucleus.org
Caution: javaJdbc app dependency downloads hibernate-entitymanager jar file that interferes with Kundera. Make sure you remove this app dependency which is by default present.
This should not be an issue with latest Kundera releases. Also you can email sample project at kundera#impetus.co.in in case looking for quick support.