Questions tagged [mongo-scala-driver]
57 questions
2
votes
0 answers
How to update BigDecimal field with mongo scala driver 2.0?
I'm using official mongo-scala-driver 2.0.0. And try update field with BigDecimal value:
myCollection.findOneAndUpdate(
equal("_id", "someId"),
set("money", BigDecimal(100.0))
).headResult()
And it give's…

zella
- 4,645
- 6
- 35
- 60
2
votes
1 answer
Scalatra and Mongo insertOne error - java.lang.NoSuchMethodError: com.mongodb.operation.MixedBulkWriteOperation.bypassDocumentValidation
After pouring through tutorials and help sites for two days, I cannot seem to find the answer to my question.
I'm new to Scala and Mongo and I'm building an HTTP server using Scalatra (v2.4.1), Scala (v2.11.8) and the mongo-scala-driver…

Russ
- 623
- 8
- 14
2
votes
2 answers
mongo-scala-driver: Getting Results
I have the following document in Mongodb:
{ "index_column" : "site_id", "mapped_column":"site_name"}
I'm using the mongo-scala-driver from my scala code to query the server. How do I get the mapped_column to a scala String variable? I tried with…

AkhlD
- 2,596
- 2
- 16
- 15
2
votes
1 answer
Mongodb scala driver doesn't insertOne document
I try to save a document in mongodb 3.0.7 using scala 2.11.7 following the quick tour: http://mongodb.github.io/mongo-scala-driver/1.0/getting-started/quick-tour/ But I run the example and nothing happen. The database, collection and document are…

Fran b
- 3,016
- 6
- 38
- 65
1
vote
0 answers
mongo-scala-driver: How do i capture both the partial results and the decoding errors in an Observable?
Is there a way when working with find operations to capture as values both emerging decoding exceptions and the data ?
When decoding all the retrieved BSONs some may have invalid properties and will not be decodable into domain object.
What i had in…

gatear
- 946
- 2
- 10
1
vote
1 answer
Scala MongoDB aggregate group and match query
I want a query that will take the latest version out of each document, and check if some given string (applicationId) is in the list allowedApplications.
documents example:
{
"applicationId" : "y...",
"allowedApplications": ["x..."],
…

sheldonzy
- 5,505
- 9
- 48
- 86
1
vote
1 answer
Magnet pattern for Scala MongoDB driver
The documentation describes using the magnet pattern to get implicit conversion to BSON types. See on this page http://mongodb.github.io/mongo-java-driver/4.1/driver-scala/bson/scala-documents/. I have tried defining an implicit object that extends…

johgio
- 13
- 3
1
vote
1 answer
collection.insertOne(doc).results() method is not available
I'm using Scala, Mongo DB, and the mongo-scala driver simple example to insert data into Mongo.
libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "2.9.0"
// step 1 : connect to mongo
val mongoClient: MongoClient =…
1
vote
1 answer
Mongo Scala Driver: PullByFilter Based on Nested Field Value
I have a model band that contains a list of tours
Band:
{
name: String,
email: String,
createdAt: String,
tours: Tour[],
...
}
where a Tour is:
{
name: String,
region: String,
published: Boolean,
...
}
The goal is simply to create an…

sinanspd
- 2,589
- 3
- 19
- 37
1
vote
1 answer
group records on key
I have collection structure as follows
{"pid" : 1 , id" : 2 ,"auther" : "xyz" , "book" : "pqr" , "time" : 1}
{"pid" : 1 ,"id" : 3 ,"auther" : "abc" , "book" : "stu" , "time" : 2}
{"pid" : 1 ,"id" : 2 ,"auther" : "def" , "book" : "vwx" , "time" : 3}…

Swapnil Sonawane
- 1,445
- 3
- 22
- 37
1
vote
1 answer
Is it possible to create a Codec Provider from a generic case class?
I am trying to make a generic function which produces a CodecProvider from a given generic case class.
The BSON macro documentation does not give any examples of this.
This (unanswered) SO question is similar, however I am not interested in…

Erp12
- 600
- 3
- 16
1
vote
2 answers
how to perform anding of oring in mongodb
my collection structure is as follows
{ name : "xyz" , priLoc :{ area : a , country : c } , secondLoc :
[ {area : b ,country : d},{area : b ,country : d} ]}
I want to make query that Oring the area both priLoc and secondLoc
and anding the country…

Swapnil Sonawane
- 1,445
- 3
- 22
- 37
1
vote
0 answers
Unable update Option[X] field in mongo-scala-driver
I have this case class:
case class CodeRegister(id: String, name: String, code: Option[CodeData])
case class CodeData(code: String, expiry: Long)
I've registered both CodeRegister and CodeData via fromProviders method. And now I've tried to update…

TheOutsider
- 63
- 1
- 10
1
vote
0 answers
How can i save Set with mongo-scala-driver?
I try to save a case class with field of Set type.
Something like this:
case class MyObject(setOfString:Set[String])
When I get my MyObject from db, i have this error:
The future returned an exception of type: java.lang.ClassCastException, with…

mkUltra
- 2,828
- 1
- 22
- 47
1
vote
2 answers
Does mongo-scala-driver support GridFs?
I look at their documentation here http://mongodb.github.io/mongo-scala-driver/1.1/ and I could not find where it is mentioned.

mmdc
- 1,677
- 3
- 20
- 32