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
2 answers

MongoiDB use a String for _id

I'd like to use a unique string per collection to id a doc. I'm using Scala and Casbah but can also use Java if needed. I know I should use Casbah collection.createIndex but I don't understand the scaladocs. If my case class is : case class…
pferrel
  • 5,673
  • 5
  • 30
  • 41
0
votes
1 answer

com/mongodb/casbah/Imports$ ClassNotFound running spark-submit and Mongo

Im having a issue when try to run a jar using spark-submit. This is my sbt file: name := "Reading From Mongo Project" version := "1.0" scalaVersion := "2.10.4" libraryDependencies += "org.mongodb" %% "casbah" % "2.5.0" Im using sbt package to…
Boris Perez
  • 47
  • 1
  • 8
0
votes
1 answer

Specify datatypes while updating MongoDB document using Casbah

I have a MongoDB document that I need to update using Casbah for scala. My mongoDB document looks like {"_id": ObjectId("58d86364fbb1bb2224cab56a"), "record_interval": [ { "record_time":…
Sid
  • 251
  • 2
  • 4
  • 17
0
votes
0 answers

ISODate Query on MongoDB using casbah in Scala

I am using Casbah for Scala to insert/update MongoDB documents. One of the challenges I am facing is querying MongoDB document by date or ObjectId. My MongoDB document looks like { "_id" : ObjectId("58d2cfe5fbb1bb15209d3b02"), "name" :…
Sid
  • 251
  • 2
  • 4
  • 17
0
votes
1 answer

Query Deep Nested MongoDB Object with Casbah [Scala]

{'_id': ObjectId('589df735be9fa2077dc5bb2e'), 'name': 'train.2', 'samples': [{'processed': {'eulerAngles': [1.946705159018607, -0.01405100477972897, …
FranGoitia
  • 1,965
  • 3
  • 30
  • 49
0
votes
1 answer

What datatype is returned by MongoCollection.find()?

I'm new to mongodb and scala and I'm currently using Casbah as my driver to interface between the two on the play framework. I can't figure out what datatype is returned by collection.find(). I'm trying to create a function that returns the result…
Usman Mutawakil
  • 4,993
  • 9
  • 43
  • 80
0
votes
1 answer

Scala - Get Last Inserted ObjectId Using Casbah MongoDB

Is there any way to get last inserted ObjectId? i can't find it on their documentation or maybe i am not digging far enough, thanks.
Julio Abdilla
  • 259
  • 1
  • 4
  • 7
0
votes
1 answer

How to correctly present a JSON resource with Casbah & Play 2

I am new to Play (and somewhat new to Scala), so forgive me if this is way off the mark, though really that is why I am posting this here. I'm trying to create a basic endpoint which goes away and does basic CRUD with…
danbroooks
  • 2,712
  • 5
  • 21
  • 43
0
votes
1 answer

Scala, casbah aggregate query

I'm a newbie to MongoDB and Casbah and I'm wondering if anyone can help me please. I have the following mongoDB Query that works, db.getCollection('holidayRequests').aggregate ( [ { $match: { $and: [ { email: "leeroy.jenkins@company.com" }…
0
votes
1 answer

Mongo casbah: cannot resolve "++"

Casbah version: 2.8.0 Following example here: http://api.mongodb.com/scala/casbah/2.0/tutorial.html#combining-multiple-dbobjects I'm using below as import statements. import com.mongodb.casbah.AggregationOutput import…
keypoint
  • 2,268
  • 4
  • 31
  • 59
0
votes
1 answer

Scala: parse JSON file into List[DBObject]

1.Input is JSON file that contains multiple records. Example: [ {"user": "user1", "page": 1, "field": "some"}, {"user": "user2", "page": 2, "field": "some2"}, ... ] 2.I need to load each record from the file as a Document to MongoDB…
Skoch
  • 1
0
votes
0 answers

Return a casbah type findOne in a method

I'm making a system using scala and I make a method that return a "findOne". Follow my code def findOneByField(field:String, value:String): Any = { val search: DBObject = MongoDBObject(field -> value) return User.coll.findOne(search).get } I…
Renato Cassino
  • 792
  • 1
  • 7
  • 27
0
votes
1 answer

writeConcern is not setting to Acknowledged in mongodb

private val DATABASE:String = config.getString("db.dbname") private val SERVER:ServerAddress = { val hostName=config.getString("db.hostname") val port=config.getString("db.port").toInt new ServerAddress(hostName,port) } val…
swaheed
  • 3,671
  • 10
  • 42
  • 103
0
votes
1 answer

connectionsPerHost and maxSize returns 10 when instantiating MongoCleint

I am using casbah scala drvier for mongodb here is how i am creating MongoClient instance val SERVER:ServerAddress = { val hostName=config.getString("db.hostname") val port=config.getString("db.port").toInt new…
swaheed
  • 3,671
  • 10
  • 42
  • 103
0
votes
0 answers

uri has type STRING rather than OBJECT in Scala and MongoDB integration?

I am working with Play framework(2.2.x) using Scala and MongoDB(v 2.6.11). I am trying to run sample application using in my system, as it is not executing the application and giving the compilation error in application.conf: uri has type STRING…
Nag
  • 129
  • 2
  • 3
  • 10