casbah

Still can't run multiple tests against play FakeApp with Salat / Casbah

霸气de小男生 提交于 2019-12-06 08:10:08
问题 I thought I had fixed the problem temporarily, but it turns out I am still having problems. I am trying to create some specs2 tests for my models layer, I would like to insert some dummy object, and then run some queries to make sure data comes out as expected. Here is what my simple test looks like: class ModelSpec extends Specification { override def is = args(sequential = true) ^ super.is object FakeApp extends FakeApplication() running(FakeApp){ println("set up database") val newUser =

MongoDB Scala Driver - Rendering BSON Documents

别等时光非礼了梦想. 提交于 2019-12-05 21:28:05
We currently have a Type-Safe query language at work, this custom DSL allows us to easily write database queries that are interpreted and converted into Mongo Queries. We recently swapped over from Casbah to the new Mongo Scala Driver and rewrote our interpreter. I am however having some issues when dealing with optional values. This is an example query: dao.headOption(Order.id === orderId.some) The type stored on the Order Object is an Option so we lift the provided id into an option as well. However whenever I try to render out the generated query for debugging as well as for test cases in

Still can't run multiple tests against play FakeApp with Salat / Casbah

有些话、适合烂在心里 提交于 2019-12-04 14:46:56
I thought I had fixed the problem temporarily, but it turns out I am still having problems. I am trying to create some specs2 tests for my models layer, I would like to insert some dummy object, and then run some queries to make sure data comes out as expected. Here is what my simple test looks like: class ModelSpec extends Specification { override def is = args(sequential = true) ^ super.is object FakeApp extends FakeApplication() running(FakeApp){ println("set up database") val newUser = User( email = "wfbarksdale@gmail.com", username = "weezybizzle", password = "nutterbutter") User.save

Why do I end up with java.lang.IllegalArgumentException for Casbah / Java MongoDB Driver?

谁说胖子不能爱 提交于 2019-12-03 22:02:47
I'm seeing a strange issue using the casbah / java driver. I keep running into the following exception when the driver tries to create a response from mongo: Oct 16, 2012 10:45:07 AM com.mongodb.DBTCPConnector$MyPort error SEVERE: MyPort.error called java.lang.IllegalArgumentException: response too long: 1634610484 at com.mongodb.Response.(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:110) at com.mongodb.DBPort.go(DBPort.java:75) at com.mongodb.DBPort.call(DBPort.java:65) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:201) at com.mongodb.DBApiLayer$MyCollection.__find

How to update object in Mongo with an immutable Salat case class

怎甘沉沦 提交于 2019-12-02 10:02:08
问题 I'm working on a project with Scala, Salat, Casbah, Mongo, Play2, BackboneJS... But it's quite a lot of new things to learn in the same time... I'm ok with Scala but I find my code crappy and I don't really know what's the solution to improve it. Basically my usecase is: A MongoDB object is sent to the browser's JS code by Play2 The JS code update the object data (through a Backbone model) The JS send back the the updated JSON to the server (sent by Backbone save method, and received by Play

How to update object in Mongo with an immutable Salat case class

无人久伴 提交于 2019-12-02 04:06:11
I'm working on a project with Scala, Salat, Casbah, Mongo, Play2, BackboneJS... But it's quite a lot of new things to learn in the same time... I'm ok with Scala but I find my code crappy and I don't really know what's the solution to improve it. Basically my usecase is: A MongoDB object is sent to the browser's JS code by Play2 The JS code update the object data (through a Backbone model) The JS send back the the updated JSON to the server (sent by Backbone save method, and received by Play with a json bodyparser) The JSON received by Play should update the object in MongoDB Some fields

Reading Huge MongoDB collection from Spark with help of Worker

♀尐吖头ヾ 提交于 2019-12-01 10:36:16
I want to read a huge MongoDB collection from Spark create an persistent RDD and do further data analysis on it. Is there any way I can read the data from MongoDB faster. Have tried with the approach of MongoDB Java + Casbah Can I use the worker/slave to read data in parallel from MongoDB and then save it as persistent data and use it. There are two ways of getting the data from MongoDB to Apache Spark. Method 1: Using Casbah (Layer on MongDB Java Driver) val uriRemote = MongoClientURI("mongodb://RemoteURL:27017/") val mongoClientRemote = MongoClient(uriRemote) val dbRemote = mongoClientRemote

Reading Huge MongoDB collection from Spark with help of Worker

筅森魡賤 提交于 2019-12-01 09:06:07
问题 I want to read a huge MongoDB collection from Spark create an persistent RDD and do further data analysis on it. Is there any way I can read the data from MongoDB faster. Have tried with the approach of MongoDB Java + Casbah Can I use the worker/slave to read data in parallel from MongoDB and then save it as persistent data and use it. 回答1: There are two ways of getting the data from MongoDB to Apache Spark. Method 1: Using Casbah (Layer on MongDB Java Driver) val uriRemote = MongoClientURI(

How to convert casbah mongodb list to json in scala / play

∥☆過路亽.° 提交于 2019-11-29 01:52:55
I'm learning scala and mongodb at present and using the play! framework, so I'm making all sorts of mistakes as I get my head around things. Currently I have a scala object that returns a list of database objects returned from a mongodb query via casbah as follows; object Alerts { def list() : List[DBObject]= { val collection = MongoDatabase.collection; val query = MongoDBObject.empty val order = MongoDBObject("Issue Time:" -> -1) val list = collection.find(query).sort(order).toList list } ... } Elsewhere in my code I wish to output the List of objects in Json - so I have; val currentAlerts =