Questions tagged [mongodb-scala]

MongoDB is a scalable, high-performance, open source, document-oriented database. This tag is used for questions related to the Scala driver for MongoDB.

The Scala Driver Documentation.

40 questions
0
votes
0 answers

How do I replicate this mongodb regex in query using mongo-scala-driver?

I can query mongodb directly using this query {key: {$in: [/faq/]}} but how do I replicate this when using Filters#in? in("key", Seq("/faq/")) doesn't work as it gets passed as a string.
pradhyo
  • 157
  • 1
  • 2
  • 19
0
votes
1 answer

Unable to make connection to MongoDB using MongoDB Scala Driver

I am using Scala driver for MongoDB to make a connection and insert a document in the class. I am following their official documentation as mentioned in this link. (http://mongodb.github.io/mongo-scala-driver/2.6/getting-started/quick-tour/) I am…
omer khalid
  • 855
  • 1
  • 12
  • 39
0
votes
1 answer

Official MongoDB Scala Driver, aggregate count sum 1

I am using official mongo scala driver: http://mongodb.github.io/mongo-scala-driver/. I want to do query like: db.test.aggregate([{"$group" : {_id:{name:"$name",details:"$details.id"}, count:{$sum:1}}}, {$sort:{"count":-1}} ]) so in scala code I am…
FrancMo
  • 2,459
  • 2
  • 19
  • 39
0
votes
1 answer

MongoDB Scala Driver counterpart to Javascript Object

I am trying to create a document with the counterpart to a Javascript Object Map[String, Any]. When I try to insert a new Document I'll get this Exception: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class…
B. Kemmer
  • 1,517
  • 1
  • 14
  • 32
0
votes
0 answers

mongodb spark connector, cannot write Dense or Sparse Vector

I try to writing my dataframe with a column typed as "dense vector" in mongodb with mongo spark connector. but i getting this error : cannot cast [2.0,2.0,115.0,0.0,0.0,0.0,0.0,0.0] into a BsonValue. org.apache.spark.ml.linalg.VectorUDT@3bfc3ba7…
harksin
  • 235
  • 2
  • 11
0
votes
1 answer

How do I bind a Scala value retrieved using mongodb-scala-driver to an identifier?

I'm converting code from Casbah to mongodb-scala-driver, and when it comes to capturing the result of a query, the best I've come up with so far is: var doc: Option[Document] = None collection.find(and(equal("name",name),equal("hobby",…
gknauth
  • 2,310
  • 2
  • 29
  • 44
0
votes
1 answer

play2 framework mongodb : [NoSuchElementException: None.get]

I am having a hard time trying to create my BSON reader/writer on play 2.1.5 with mongodb. Here is a code excerpt in app/model/Boat.scala : implicit object BoatBSONReader extends BSONDocumentReader[Boat] { def read(doc: BSONDocument): Boat = …
Manel
  • 1,616
  • 19
  • 42
0
votes
2 answers

Block a change field in mongoDB

I have a collection in MongoDB which makes an increase, the field was initially defined as an Integer, but I find that after the increase was converted to double. But then I make an update of the document and see that changes to Long. Is there any…
jmmontero
  • 169
  • 3
  • 13
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

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…
1 2
3