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

Using Casbah in Scala/Scalatra to query for a document

I am slightly confused on how to retrieve an individual document from MongoDB using Casbah in my Scalatra project. Currently, I have some code that hypothetically looks like the following: get ("/dogs") { val collar_id =…
randombits
  • 47,058
  • 76
  • 251
  • 433
0
votes
2 answers

Expire a Collection in Mongo using Casbah EnsureIndex

I am attempting to expire a collection in Mongo using Casbah's ensureIndex API. Based on this document http://docs.mongodb.org/manual/tutorial/expire-data/ I am using casbah's proposed ensureIndex API collection.ensureIndex(DBObject("status"…
conikeec
  • 209
  • 2
  • 14
0
votes
0 answers

$addToSet $each exception in casbah 2.6.2

After moving from casbah 2.6.1 to 2.6.2, I got the following exception for $addToSet $each update queries. val s = Set(1,2,3) $addToSet("ids") $each(s) java.lang.NoSuchMethodException: …
deepkimo
  • 3,187
  • 3
  • 23
  • 21
0
votes
1 answer

Casbah - check if string is parseable as ObjectId

Is there a simple built in way to check if a string is a valid ObjectId? I know if I try to construct an ObjectId from an invalid string it throws an exception, is there a way to circumvent the try-catch block? One possible way would be to check…
laci37
  • 510
  • 4
  • 17
0
votes
1 answer

findOneById is not a member of com.mongodb.casbah.MongoCollection

I'm using Casbah 2.6.2 for MongoDB driver on scala "org.mongodb" %% "casbah" % "2.6.2", I'm having trouble accessing MongoCollection#findOneById (http://mongodb.github.io/casbah/api/#com.mongodb.casbah.MongoCollection). I'm getting the following…
real
  • 491
  • 4
  • 17
0
votes
1 answer

Doing a MongoDB findAndModify query including $addToSet in Casbah

I am both new to scala and cashbah. I am trying to update a document if exists (by _id) and create if doesn't exist. while updating, update some key values while updating, update some keys which values are sets, include some data to those sets. To…
Umut Benzer
  • 3,476
  • 4
  • 36
  • 53
0
votes
1 answer

Attaching casbah source in eclipse

I am having trouble attaching the source for the mongodb casbah library in eclipse. I couldn't find a source jar anywhere, so I downloaded the source from github, but I didn't know what the appropriate branch/version would be, so I just used the…
Bjorn Roche
  • 11,279
  • 6
  • 36
  • 58
0
votes
1 answer

Serving files from GridFS with casbah/salat

I would like to store images uploaded as user content in GridFS in a Scala Play 2 application. How can I restore the binary file from the GridFSDBFile that GridFS.findOne gives me?
laci37
  • 510
  • 4
  • 17
0
votes
1 answer

runcommand is not a memeber of casbah mongocolection

db.foo.insert( { _id: 1 , desc: "the dog is running" } ) db.foo.insert( { _id: 2 , desc: "the cat is walking" } ) db.foo.ensureIndex( { "desc": "text" } ) db.foo.runCommand( "text", { search : "walk" } ) This is run in mongo How can i run in the…
0
votes
0 answers

Composite ID with mongoDB java Driver

I have a java object which I need to save in mongoDB and the identifier in mongoDB is typically a complex one, with two fields: _id.valueA and _id.valueB . However, my data structure is flat with respect to valueA and valueB (i.e. these are two…
Edmondo
  • 19,559
  • 13
  • 62
  • 115
0
votes
1 answer

Scala, Casbah: MongoCollection.insert compilation errors

I am trying to write function that writes data to MongoDB using Casbah toolkit: import com.mongodb.casbah.WriteConcern import ... def saveRecord(rec: MongoDBObject) { mongoColl.insert(rec) } I get the following errors: 1) No…
Anton Ashanin
  • 1,817
  • 5
  • 30
  • 43
0
votes
1 answer

Casbah MongoDB toolkit for Scala: can't create connection and collection

I am trying to work with Casbah MongoDB toolkit for Scala. I am running MongoDB on localhost, it works fine. Yet the following code does nothing - no database and no collection get created.And no exception is thrown: package test.scalamongo import…
Anton Ashanin
  • 1,817
  • 5
  • 30
  • 43
0
votes
1 answer

Scala fluid syntax with Casbah toolkit for MongoDB

I am new to Scala and trying to use Casbah toolkit for MongoDb. Casbah tutorial says: "...This should allow a more fluid Syntax to working with Mongo. The DB object also provides an apply() for getting Collections so you can freely chain…
Anton Ashanin
  • 1,817
  • 5
  • 30
  • 43
0
votes
1 answer

Casbah Maven dependency FAILS in Eclipse Scala-IDE?

I am trying to use Casbah - Scala toolkit for MonfoDB in Eclipse Scala-IDE Maven project. Maven fails at Casbah dependency with the following errors: Missing artifact com.mongodb.casbah:casbah_2.10.0:pom:2.5.0 pom.xml Please help to fix this. What…
Anton Ashanin
  • 1,817
  • 5
  • 30
  • 43
0
votes
4 answers

MongoDB+Scala: Accessing deep nested data

I think there should be an easy solution around, but I wasn't able to find it. I start accessing data from MongoDB with the following in Scala: val search = MongoDBObject("_id" -> new ObjectId("xxx")) val fields =…
Max Leeds
  • 15
  • 4
1 2 3
17
18