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
3
votes
1 answer

Retrieve documents having array containing another document attribute

I am storing some kind of filesystem in Mongo, where directories are named categories. The category JSON looks like: { "name":"CategoryChildLevel2", "parentId":"2", "otherAttribute":"anyVal", "breadcrumb":[ { …
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
3
votes
1 answer

Mongo $elemMatch in Casbah

I'm using Casbah 2.9.2 My mongodb schema looks like: [ _id : "Triangle", Info : [ Color : "Red", Line : "Thin", UseID : "1", SourceId : "2" ] ] I want to be able to write an update line that first checks if _id, Color and Line are together unique,…
Jake
  • 73
  • 1
  • 5
3
votes
3 answers

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

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…
wfbarksdale
  • 7,498
  • 15
  • 65
  • 88
3
votes
1 answer

Reading the results of a Casbah MongoDB query

I have a document in MongoDB that looks like this: {"_id":"asdf", "data":[ {"a":"1","b":"2"}, {"a":"3","b":"4"}, {"a":"5","b":"6"}, ]} I would like to query that object using Scala, and convert the entries in "data" into a list of…
Ben Dilts
  • 10,535
  • 16
  • 54
  • 85
2
votes
1 answer

CRUD operations using Scalatra and Casbah

I'm learning Scala and MongoDB and such am using Scalatra and Casbah as the framework for a simple web app. It is a simple message board, the intention to learn CRUD operations in Casbah. Problems is I'm finding that when I list the messages I have…
Michael Allen
  • 5,712
  • 3
  • 38
  • 63
2
votes
2 answers

How to convert a scala object with list to a MongoDBObject via Casbah

I'm learning MongoDB and Casbah by writing a simple app. Got stuck when I try to convert an object with a list member into a MongoDB Object. Here is my class case class BorrowerRecord( name: String, checkedOut: List[BookTag]) { …
Ferdinand Chan
  • 77
  • 1
  • 3
  • 7
2
votes
1 answer

Error: class file needed by ValidDateOrNumericTypeHolder, need RegisterJodaTimeConversionHelpers() - its hopeless, I can't find the import

maybe I'm blind or something but I can't find the import what I need. I'm playing with scala + mongodb. Everything is fine, I just have some problems with this JodaTimer. In this tutorial you have to import it like this: import…
OverStack
  • 747
  • 3
  • 12
  • 18
2
votes
2 answers

Group By (Aggregate Map Reduce Functions) in MongoDB using Scala (Casbah/Rogue)

Here's a specific query I'm having trouble with. I'm using Lift-mongo- records so that i can use Rogue. I'm happy to use Rogue specific syntax , or whatever works. While there are good examples for using javascript strings via java noted below, I'd…
Jonathan Hendler
  • 1,239
  • 1
  • 17
  • 23
2
votes
3 answers

maven throwing error when adding casbah to it

I have added casbah to my dependancies using com.mongodb.casbah casbah_2.8.0 2.1.5.0 Then i just wrote a simple mongo connection statement val…
swordfish
  • 4,899
  • 5
  • 33
  • 61
2
votes
1 answer

Datatype changes from Int to Float when using group aggregation

I'm trying to use the group aggregation. I have documents of the following structure in my mongodb: { "_id" : ObjectId("4ddcdc9ab4d8a3a90345508e"), "vehicleId" : "1", "timestamp" : ISODate("2011-05-25T10:40:25.856Z"), "speed" : 1 } { "_id" :…
Christian
  • 4,543
  • 1
  • 22
  • 31
2
votes
2 answers

expand for MongoDB Scala driver?

Casbah has an expand function that lets you retrieve nested keys. Does the newer MongoDB Scala Driver have this functionality?
Gabriel
  • 1,679
  • 3
  • 16
  • 37
2
votes
0 answers

Mongo- get document field value while updating

Is it possible to get the current document field value while updating it similar to the $where operator? I'm trying to insert(or update) a field with a key name that is the value of another key in the updated document. I'm using casbah with Scala :…
user_s
  • 1,058
  • 2
  • 12
  • 35
2
votes
1 answer

Relate children to parent using Mongo aggregate query

I have a single collection named assets that contains documents in 2+ formats, ParentObject and ChildObject. I am currently associating ParentObject to ChildObject with two queries. Can this be done with an aggregate query? ParentObject { …
Kevin Harper
  • 23
  • 1
  • 4
2
votes
1 answer

salat: GRATER GLITCH - ClassNotFoundException

I'm trying to make work a very simple example of Salat. build.sbt: libraryDependencies += "com.novus" %% "salat" % "1.9.9" In sbt console: import com.novus.salat._ import com.novus.salat.global._ import com.mongodb.casbah.Imports._ case class…
thomas legrand
  • 493
  • 1
  • 5
  • 16
2
votes
1 answer

Find query result to List

I have got a database filled with documents like the following : { "_id" : ObjectId("56zeffb2abcf7ff24b46"), "id_thing" : -1, "data" : { "info1" : 36.0709427, "date" : ISODate('2005-11-01T00:33:21.987+07:00'), …
wipman
  • 581
  • 6
  • 22