Questions tagged [reactivemongo]

Asynchronous & Non-Blocking Scala Driver for MongoDB

508 questions
2
votes
1 answer

ReactiveMongo BSONHandler for Map

I have following class, and want to use reactivemongo.bson.Macros.handler to get the reader and writer automatically. case class Data(a: String, b: Map[String, String]) object Data { implicit val dataHandler =…
宇宙人
  • 1,197
  • 3
  • 10
  • 28
2
votes
1 answer

Scala Define a generic class that only accepts case classes

When defining a generic class in Scala how can I ensure that the type parameter 'A' must be a case class? class TypedCollection[A](name: String){} Context: I'm trying to define a generic 'TypedCollection' wrapper class to interact a reactivemongo…
2
votes
0 answers

ConnectionNotInitialized exception on MongoDB write operation

I have two Docker containers: Running MongoDB Service using ReactiveMongo to connect to said MongoDB The code I use to connect to the MongoDB: trait MongoHelper { this: BaseConfig => val dbKey: String val collKey: String lazy val…
thwiegan
  • 2,163
  • 10
  • 18
2
votes
1 answer

How to debug actor timeout reactivemongo api cursor fails to send request logback hell

Scala Play app with reactive mongo akka actors sbt run: I occasionaly get this error like ten times on sbt console: It usually happens after a recompile and play reload, otherwise it happens less often, it doesn't cause anything to fail, sometimes…
user3995789
  • 3,452
  • 1
  • 19
  • 35
2
votes
1 answer

ReactiveMongo: No mongo-async-driver configuration found

I am starting out with ReactiveMongo, and while log level is set to debug I see the following print to the log: application - ReactiveMongoApi starting... reactivemongo.api.MongoDriver - No mongo-async-driver configuration found application -…
Gleeb
  • 10,773
  • 26
  • 92
  • 135
2
votes
3 answers

ReactiveMongo w/ Play Scala

New to play,scala, and reactivemongo and the documentation is not very noob friendly. I see the Bulk Insert section at See Bulk Insert but I don't know why they aren't showing it contained in a method? I am expecting a request with JSON data…
Jeff
  • 211
  • 3
  • 11
2
votes
2 answers

How to convert JSON String to a BSONDocument

I have the following function that uses the reactivemongo driver and actually does a good job writing to the database. def writeDocument() = { val document = BSONDocument( "firstName" -> "Stephane", "lastName" -> "Godbillon", …
summerNight
  • 1,446
  • 3
  • 25
  • 52
2
votes
0 answers

ReactiveMongo socket disconnect

Logs: OUT 08:52:27.158 [reactivemongo-akka.actor.default-dispatcher-4] ERROR reactivemongo.core.actors.MongoDBSystem - The primary is unavailable, is there a network problem? ERR reactivemongo.core.errors.GenericDriverException: MongoError['socket…
2
votes
0 answers

ReactiveMongo reference annotations

I have some general questions about ReactiveMongo plugin. I have previously used Morphia with Play and we have now migrated to scala and I would like to clarify some things. 1) Is it a good practise to use @References annotations similar to…
glarkou
  • 7,023
  • 12
  • 68
  • 118
2
votes
2 answers

How to map two `future` results in Scala/ReactiveMongo?

I have an application, written with Play and ReactiveMongo, where I want to: Have an action that inserts a landingPage document into MongoDB. Insert the new landingPage and wait for that to insert. Count the new total number of landingPage…
Amy B
  • 17,874
  • 12
  • 64
  • 83
2
votes
0 answers

Stopping Enumerators and Iteratees in PlayFramework when the request is closed

I am using enumerators in a Play Framework application. When a request is sent to a specific URI, I call a MongoService (using reactivemongo) that returns an enumerator and this result is then sent through an HTTP stream using Ok.chunked(stream),…
vicaba
  • 2,836
  • 1
  • 27
  • 45
2
votes
2 answers

ReactiveMongo FindAndModify Clarification

I have a collection in my MongoDB database with say several keys. Now I want to update this collection with a new field. So here is what I have so far: def confirm(hash: String) = { val myDb = dbConn.db(dbName) val userCollection =…
joesan
  • 13,963
  • 27
  • 95
  • 232
2
votes
1 answer

How to specify the replicaSet name with ReactiveMongo?

When opening a connection to multiple mongoDB servers with ReactiveMongo, we can pass it a list of hosts to connect to. However I don't find any way to provide the replicaSet name (as we can do in standard MongoDB URIs). Even the URI parser of…
clemp6r
  • 3,665
  • 2
  • 26
  • 31
2
votes
1 answer

ReactiveMongo: How to convert a BSONArray to List[String]

Given the following BSONDocument... val values = BSONDocument("values" -> BSONArray("one", "two", "three")) How do I convert it to a List? I've tried this... values.getAs[List[String]]("values").getOrElse(List.empty)) ... but it doesn't work - I…
j3d
  • 9,492
  • 22
  • 88
  • 172
2
votes
2 answers

embedmongo with reactivemongo process does not exit

I am trying to do some tests using ScalaTest + embedmongo + reactivemongo but I fail. My first problem is that after a test mongod process does not shut down, I have this message in console: INFO: stopOrDestroyProcess: process has not exited and…
Łukasz
  • 8,555
  • 2
  • 28
  • 51