Questions tagged [mongo-scala-driver]
57 questions
1
vote
2 answers
Mongo Scala Driver Collection Does Not Update Document
I'm able to insert, read, and delete but I cannot get either updateOne or updateMany to modify documents.
I'm using MongoDB 3.2.7 with libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "1.1.1"
def read() = {
val query =…

Everus
- 358
- 3
- 17
1
vote
2 answers
Mongo-Scala Driver unique index
I want to create unique index to a collection using Mongo-Scala Driver. This driver is new and also I am new to Scala. I am not able to create index via both these two methods.
collQueries.createIndex(Document("name" -> 1, "unique" -> true))
And…

rg41
- 131
- 2
- 6
0
votes
1 answer
scala mongodb document getList
I would like to get groups attribute as Seq[Int] from the given mongodb Document. How to do it? The method getList catches a runtime exception, and I would like to understand and fix it.
n:…

vadtam
- 343
- 4
- 15
0
votes
1 answer
mongo-scala-driver does not insert
I have approximately this database wrapper class:
class MyDatabase {
private def getMongoClientSettings(): MongoClientSettings = {
val uri = "mongodb://localhost:27017"
val mongoClientSettings =…

vadtam
- 343
- 4
- 15
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
inherited elements of a case class not getting persisted into mongodb using scala mongo driver
I wanted to persist to mongo db using mongo-scala-driver 2.7.0 . My case class looks a bit as follows
case class App(
@BsonProperty("_id") id: String = "",
appName: String
createdBy: String,
…

95_96
- 341
- 2
- 12
0
votes
2 answers
MongoDB with Scala language
i am new to MongoDB and Scala language
i am using scala language to connect mongodb locally
i am using below dependency
//
https://mvnrepository.com/artifact/org.mongodb.scala/mongo-scala-driver
libraryDependencies += "org.mongodb.scala" %%…

Piyush Jiwane
- 179
- 3
- 13
0
votes
0 answers
mongo-scala-driver: returning an iterator of results
I am using Mongo Scala Driver to read documents from MongoDb. I have following method as follow which returns Future[List[T]]
def findAll(): List[Future[List[T]] = {
db.getCollection(collectionName)
.find(queryObject)
.toFuture()
…

oblivion
- 5,928
- 3
- 34
- 55
0
votes
1 answer
Scala MongoDB groupby multiple fields
I'm trying to use the following (example) query in the MongoDB Scala driver:
db.getCollection('datatype').aggregate(
[
{ "$match": { "allowedApplications": ".." }},
{ "$group": { "_id": {"name": "$name", "applicationId": "$applicationId"},…

sheldonzy
- 5,505
- 9
- 48
- 86
0
votes
1 answer
Mongo bulk replace with 200k+ operations
E.g. I have such documents in the collection:
{
"key": "key1",
"time": 1000,
"values": [] // this one is optional
}
I need to update the collection from, let's say, CSV file by modifying or removing values column and where key & time…

Andrii Abramov
- 10,019
- 9
- 74
- 96
0
votes
0 answers
Read full collection through spark mongo connector with sequential disk access?
I want to read a full MongoDB collection into Spark using the Mongo Spark connector (Scala API) as efficiently as possible in terms of disk I/O.
After reading the connector docs and code, I understand that the partitioners are all designed to…

Mike Trotta
- 546
- 4
- 6
0
votes
0 answers
Creating mongo codecs automatically for nested case classes
I want to create automatically mongo codecs for nested case classes which are big and have many levels of composition.
As a simple example, let's say I want to create codecs for the following classes:
case class Person(name: String, address:…

Or Bar Yaacov
- 259
- 3
- 13
0
votes
1 answer
mongo-scala-driver :how to add connection pool size in MOngoClient Settings
i am new to mongo scala driver i am trying to add connection pool size when initiating a mongo instance
i am doing it something like this
val settings: MongoClientSettings = MongoClientSettings.builder()
…

swaheed
- 3,671
- 10
- 42
- 103
0
votes
1 answer
Mongo Number of Connections is Negative (Connections Don't Properly Terminate)
I have a service that connects to a Mongo Cluster running on MongoAtlas. The test suite, for the time being, connects to the cluster runs a number of tests, destroys the created data and closes the connection, at least thats what it is supposed to…

sinanspd
- 2,589
- 3
- 19
- 37
0
votes
1 answer
Example of mongo-scala-driver transaction
Mongodb 4 added multi document transaction support.
Mongo-scala-driver (http://mongodb.github.io/mongo-scala-driver/2.4/) supports mongodb 4, but I cannot find any example how to use transaction with scala.
Can anybody provide the link or code…

Teimuraz
- 8,795
- 5
- 35
- 62