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 convert MongoDBList to BasicDBList?

I use Casbah 2.5.0. There is example in tutorial: scala> val builder = MongoDBList.newBuilder scala> builder += "foo" scala> builder += "bar" scala> builder += "x" scala> builder += "y" builder.type =…
un1t
  • 4,259
  • 2
  • 30
  • 33
0
votes
1 answer

mongodb querying regex with casbah fluid syntax

I am having an issue with querying against a regex with fluid dsl syntax, i am trying to say something like ("id" -> foo) using fluid. foo is a regex, so there is no $elemMatch on regex so I am getting "No implicit view available from Regex to…
Alex
  • 2,342
  • 1
  • 18
  • 30
0
votes
1 answer

How to specify salat DAO model for nested list of mixed type?

I have data coming back from MongoDB that looks like this: > db.foo.findOne() [ { "_id" : "some string", "bar" : [ [ 14960265, 0.5454545454545454 ], [ …
mrjf
  • 1,117
  • 1
  • 12
  • 22
0
votes
1 answer

MongoDB Insert Behavior with Casbah and Scala

I'm using casbah in Scala to do inserts into MongoDB and not understanding some behavior I'm seeing. val wr = dao.collection.insert(myRecord, dao.defaultWriteConcern) val error = wr.getCachedLastError Ok, nothing fancy here. In fact if I insert a…
Greg
  • 10,696
  • 22
  • 68
  • 98
0
votes
2 answers

Casbah: How to Update and Embedded Object When Field Names Have Spaces?

Supposing I had the following document in a database: {"_id":"test", "with space":{"a name":1}} How can I write a $set query in Casbah to update "with space"."a name" to 2? I was thinking something along the lines…
Eduardo
  • 8,362
  • 6
  • 38
  • 72
0
votes
1 answer

Reading file contents with casbah gridfs throws MalformedInputException

Consider the following sample code: it writes a file to mongodb and then tries to reread it import com.mongodb.casbah.Imports._ import com.mongodb.casbah.gridfs.Imports._ object TestGridFS{ def main(args: Array[String]){ val mongoConn…
Jean
  • 21,329
  • 5
  • 46
  • 64
0
votes
1 answer

Casbah - parametric find or findOne do not return what is there

I have the problem exactly as it is described in the title. For example, if I try: val key = "myKey" val value = "myVal" val one = Option(collection.findOne(MongoDBObject(key -> value))) val all = collection.find(MongoDBObject(key ->…
noncom
  • 4,962
  • 3
  • 42
  • 70
0
votes
2 answers

incorrect JARs for Casbah in Scala?

import com.mongodb.casbah.Imports._ val newObj = MongoDBObject( "abc" -> 1, "def" -> 2 ) This gives me the following error: "class file needed by ValidDateOrNumericTypeHolder is missing. reference value joda of package org refers to nonexisting…
Ashwin
  • 445
  • 5
  • 9
0
votes
1 answer

Extracting value from MongoDB DBObject using Scala/Casbah

I want to extract a value of a certain key, "orderItems" in this case, from the DBObject returned from Casbah's MongoCollectionBase.find(...). I have the solution but I am not satisfy with it. I found my solution cumbersome. It casted and converted…
thlim
  • 2,908
  • 3
  • 34
  • 57
0
votes
1 answer

Equivalent Mongodb idiom for batch queries

What is the most efficient way to query mongo collections in batches? For instance in SQL I'd do something like: SELECT * FROM Foo WHERE id > {{floor}} limit 1000; I've found that I can do something as outlined here but the big warning about skip…
Dan.StackOverflow
  • 1,279
  • 4
  • 18
  • 28
-1
votes
1 answer

Scala Salat BasicDBObject cannot be cast to

I've spent so much time and still don't understand what the problem here. So I have a collection that data looks like: { "_id" : "someId", "employment" : { "data" : [ { "retrieved" : { "$date" : "2015-03-12T14:39:41.214Z"} , "value" : { "city"…
invis
  • 1,078
  • 2
  • 14
  • 26
1 2 3
17
18