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

Define custom serialization with Casbah / Salat - or delegate serialization to member?

I'm in the process of learning Scala for a new project having come from Rails. I've defined a type that is going to be used in a number of my models which can basically be thought of as collection of 'attributes'. It's basically just a wrapper for a…
Russell
  • 12,261
  • 4
  • 52
  • 75
3
votes
1 answer

Casbah/Salat: How to query a field that a part of a string is contained?

i try to write a query with Casbah and Salat to query a field that it includes parts of a name. I tried to use a regular expression like this (inside a SalatDAO): val regexp = (""".*"""+serverName+""".*""").r val query = "serverName" -> regexp val…
Odo
  • 209
  • 1
  • 12
3
votes
2 answers

using $in in find() query in casbah

I'm trying to use casbah's fluid querying in find(). My data is like this: { "_id" : ObjectId("4d7b26efc58bf2b18f14d9cd"), "srcID" : [ "/m/05zppz" ], "relation" : [ "/location/location/people_born_here" ], "dstID" : [ "/m/06sfnt9" ] } { "_id" :…
3
votes
2 answers

deploying a scala app built using IDEA

I developed a simple scala app that uses casbah to query the DB for the command line argument passed to it. For example $ querydb.scala execution 10 it will run a casbah query to find 10 records matching execution in mongo. Now i have two…
swordfish
  • 4,899
  • 5
  • 33
  • 61
3
votes
1 answer

Casbah & Rogue for MongoDB - Querying capabilities

I'm currently using Casbah with MongoDB for implementing web service. I am having no problems with it so far. I am using Scala as well. However, I was just curious to know if there is something better than Casbah for doing a lot of find/findOne…
gofeddy
  • 579
  • 8
  • 20
3
votes
1 answer

MongoDB Casbah query field not exist or specific value

I would like to perform a query using casbah in order to find all objects that have a certain field not set (the field does not exist) or the field has a particular value. I have tried using val query = ("_id.serviceName" $in serviceNames) ++…
Matroska
  • 6,885
  • 14
  • 63
  • 99
3
votes
1 answer

MongoDB Scala Driver - Rendering BSON Documents

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…
Richard
  • 457
  • 1
  • 6
  • 21
3
votes
1 answer

How to efficiently encode a Scala tuple in MongoDB

Given the following type type GeoLocation = (Double, Double) I would like to store this in my database as location: [-55.23, 123.7] Furthermore, the location data is optional, so the API exposes Option[GeoLocation]. When it's time to store the…
andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
3
votes
1 answer

Casbah: No implicit view available error

In a Play app, using Salat and Casbah, I am trying to de-serialize a DBObject into an object of type Task, but I am getting this error when calling .asObject: No implicit view available from com.mongodb.casbah.Imports.DBObject => …
memoizr
  • 2,081
  • 2
  • 18
  • 24
3
votes
0 answers

Serializing a Scala Enum with Casbah

How to serialize a Scala enum with Casbah ? I have this error : [info] java.lang.IllegalArgumentException: can't serialize class scala.Enumeration$Val [info] at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:270) [info] at…
Yann Moisan
  • 8,161
  • 8
  • 47
  • 91
3
votes
0 answers

Scala, Mongodb with casbah + salat. Atomic operation

I have the following DAO method: /** * Delete a Program (hard delete), or mark as deleted (soft delete) * will only hard-delete if: * * No other program is based on this one * * The program is not live */ def delete(id:…
nfvindaloo
  • 948
  • 2
  • 11
  • 24
3
votes
2 answers

Programmatically enable sharding + choosing shard key on a collection using casbah with Mongo 2.4

I am attempting to programmatically "enable sharding" and set the "shard key" using java/scala API particularly casbah Our config scala 2.10 casbah 2.6 - "org.mongodb" % "casbah_2.10" % "2.6.0", MongoDB 2.4.4 Also what is the casbah driver version…
conikeec
  • 209
  • 2
  • 14
3
votes
1 answer

How to access binary data in mongoDB from scala (casbah)

I am new to mongoDB, so this may be a really stupid question... I am trying to access a rails mongo session store from scala. val sessions = MongoConnection("localhost", 27017)("databaseName")("sessions") val session =…
jgrowl
  • 2,117
  • 2
  • 17
  • 23
3
votes
1 answer

Scala app exceeds Heroku memory quota

I am hosting the backend for my mobile application on Heroku. It's written in Scala using Scalatra to expose the REST API. In addition to that, I'm running a worker that fetches data and pushes it to the database at MongoHQ (using casbah). For both…
Marco Lamina
  • 3,326
  • 4
  • 22
  • 22
3
votes
2 answers

Howto test Custom Json Objects with Spray Routing

I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operations, this all works fine, expect whenever I try to test it with specs2 the following specification class RestServiceSpec extends Specification with Specs2RouteTest…
Gertjan Assies
  • 1,890
  • 13
  • 23
1 2
3
17 18