Questions tagged [casbah]

Casbah integrates a Scala toolkit layer on top of the official MongoDB Java driver.

Casbah is end-of-life (EOL):

Users are encouraged to migrate to the Mongo Scala Driver for a modern idiomatic MongoDB Scala driver.

Casbah is a Scala toolkit for MongoDB. We use the term “toolkit” rather than “driver”, as Casbah integrates a layer on top of the official mongo-java-driver for better integration with Scala. This is as opposed to a native implementation of the Mongo Wire Protocol, which the Java driver does exceptionally well. Rather than a complete rewrite, Casbah uses implicits and Pimp My Library code to enhance the existing Java code with fluid, Scala-friendly syntax.

Documentation and source code

Related Links

266 questions
0
votes
1 answer

how to see if write concern.Acknowledged succeeded or not

Hi i just read about WriteConcern in MongoDB and want to apply in my code as well all i am doing is this val mYdb = client("myDB")//get database Name val collection = mYdb("directUser")//get collection Name collection.drop() val…
swaheed
  • 3,671
  • 10
  • 42
  • 103
0
votes
0 answers

play2 mongodb MongoCursor to Json

I am using Play2 framework with play-reactivemongo and casbah. I have the following Code: def geofence(lat:Float, lon:Float, rad:Float) = Action { request => val mongoColl = MongoConnection()("db")("geofence") …
0
votes
1 answer

Casbah scala nested document print

I am new to Casbah and scala. How can i access nested document in scala? I have few fields defined here and as you can see Currency and Ratios are nested document. When I am trying to print Currency.ExchangeCCY it gives me an error. How can i get…
user3341078
  • 449
  • 1
  • 5
  • 16
0
votes
1 answer

Casbah - getAsOrElse not working on Option values

I have the following code: new Room( dbObject.get("_id").get.toString, List[User]() , List[Message](), dbObject.getAs[Date]("creation").get, //dbObject.getAsOrElse[Option[Date]]("expires", None), if(dbObject.containsField("expires")) …
user866364
0
votes
1 answer

Casbah - How to create a find based on object?

I'm creating a find method that receives an object and for each attribute that is not null, i need to set his value on MongoDBObject. I'm having problems to use $in operator. Here is what i'm trying to do: def findRooms(room:Room) = { val query…
user866364
0
votes
1 answer

Best way to create bulk upsert with casbah

im using BulkWriteOperation in order to insert bulk Documents ,this is my code val builder: casbah.BulkWriteOperation = collection.initializeOrderedBulkOperation for(p<-posts){ if (p._1.\("object_id").asOpt[String].getOrElse("") != "" &&…
MIkCode
  • 2,655
  • 5
  • 28
  • 46
0
votes
1 answer

resolviing SBT dependencies

I am new to JVM development (I am using Scala and SBT) and am having trouble resolving dependencies. Yesterday, I had trouble resolving the org.restlet.2.1.1 dependency and today, I am having trouble with resolving the following: [error] (*:update)…
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
0
votes
1 answer

Finding the maxing value of an attribute in mongoDB using casbah

I am a newbie to casbah and mongodb. I am trying to write a scala code to find max value of of a column. For example: {"_id"=1,value = "a"} {"_id"=2,value = "b"} {"_id"=3,value = "c"} {"_id"=4,value = "d"} The program should display the max…
optimus
  • 77
  • 1
  • 6
0
votes
1 answer

Best way to use Scala MongoClient in Play 2.0

I have just started using Play 2.0 with Scala and Casbah for connecting to MongoDB. I have been able to connect to my MongoDB instance but what I am looking for is a way to be able to access the MongoClient from all my model classes. Is there any…
GTY
  • 417
  • 4
  • 15
0
votes
1 answer

Specifying MongoDBObject as content of $set

I need to construct an update query like this: { $set: {"yow": 1, "man": 2}, $setOnInsert: {"a": 3}, } I just don't know how to do it using Cashbah. The thing is the value for the $set, I got it from a JSON String (which I parsed into…
Cokorda Raka
  • 4,375
  • 6
  • 36
  • 54
0
votes
1 answer

How to create builder for $set operation in casbah?

I can't create adequate builder for $set operation in casbah For example this function work properly, if both username and lang are defined def updateUser(userId: String, username: Option[String], lang: Option[String]) = { val updatedUser =…
vdshb
  • 1,949
  • 2
  • 28
  • 40
0
votes
1 answer

Casbah MongoDB Error

I have the Casbah MongoDB driver that I use in my Web Application and when I tried to connect to the Database which is when the Casbah driver API's are called, I face a strange error: play.api.Application$$anon$1: Execution…
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
0 answers

MongoCursor size is decreasing when it is converted to list using toList

I am having weird issue with mongo cursor. I am using casbah to access Mongo through Scala code. I have following code: val cur = collection.find(MongoDBObject("brand" -> "someBrand") val items = cur.toList.map(dbo => ScalaJack.readDB [ T ]…
turiLauke
  • 11
  • 1
0
votes
1 answer

Casbah MongoDB driver compiler error

I'm using the Casbah driver for MongoDB and while I compiled my project, it fails with the following error: [INFO] Compiling 12 source files to /core/target/classes at 1394903201140 [ERROR] error: bad symbolic reference. A signature in…
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
1 answer

Casbah missing reference error for "MongoCursor" using Eclipse

I've been getting this error whenever I'm using Scala libraries for MongoDB. bad symbolic reference. A signature in Implicits.class refers to type MongoCursor in package com.mongodb which is not available. It may be completely missing from the…
Eric
  • 5
  • 2