Asynchronous & Non-Blocking Scala Driver for MongoDB
Questions tagged [reactivemongo]
508 questions
3
votes
1 answer
Bulk insert / Insert many with Play Framework, ReactiveMongo
I am building an app using Play Framework 2.5.0 and ReactiveMongo and I am spending a lot of time, stuck, on something that would be very easy to do in most web languages.
That thing is inserting many documents at once.
To do so, I must use the…

Daniel
- 1,172
- 14
- 31
3
votes
1 answer
How to setup Play!2.5 with ReactiveMongo
I connect to MongoDB with Scala using :
val driver = new MongoDriver
val connection = driver.connection(List("myhost"))
val db = connection.database("mydb")
This works fine but how to integrate this with a Play controller :
@Singleton
class…

blue-sky
- 51,962
- 152
- 427
- 752
3
votes
0 answers
ReactiveMongo Aggregate with Cursor
I'm trying to perform a ReactiveMongo aggregate call with a cursor, to avoid the Result Size restrictions.
def sumPerUser(appId: String, date: DateTime): Future[Seq[UserImpressionSums]] = {
import…

Cigogne Eveillée
- 2,178
- 22
- 36
3
votes
0 answers
MongoLab with ReactiveMongo Authorization Problems
I have a small connection routine which is as below:
val dbName = "myDb"
val user = "myUser"
val pass = "myPass"
val mongoDriver = new reactivemongo.api.MongoDriver()
val db = MyDBObject(
mongoDriver.connection(
…

joesan
- 13,963
- 27
- 95
- 232
3
votes
2 answers
Scala for comprehension with Future, List and Option
I am building a reactive site in Scala and Play Framework, and my data models are such that I often need to compose Future and Option, and build Future of List / Set from previous values to get the result I need.
I wrote a simple app with a fake…

sanchezjjose
- 33
- 6
3
votes
0 answers
Converting Play Enumerator to reactive stream Publisher
I can get enumerator from mongodb, using reactivemongo like,
val enumerator = collection.find(rangeQuery)
.cursor[State]
.enumerate()
How to stream from this enumerator, using akka-http and akka-stream ?
I have converted the…

S.Karthik
- 1,389
- 9
- 21
3
votes
1 answer
Play2 Framework/Scala/Specs2 - Do different FakeApplications share Singleton objects?
I'm quite new to Play2 and Scala. I'm writing a simple application that uses ReactiveMongo plugin.
I wrote a simple object to use as DAO
object UserDAO {
def db: reactivemongo.api.DB = ReactiveMongoPlugin.db
def collection: JSONCollection =…

tano
- 836
- 1
- 10
- 25
3
votes
1 answer
Creating a Play Enumeratee that groups similar elements into lists with a maximum size
I want an Enumeratee that groups elements in the Enumerator into groups of up to a max size, where all elements in the group have the same value. So it will scan through the Enumerator and pull values out as long as their value is the same. When…

Wade
- 346
- 2
- 12
3
votes
2 answers
Reactivemongo Insert (Map[String,String])
I've a MongoDB collection where I want to store documents like this:
{
"_id" : ObjectId("52d14842ed0000ed0017cceb"),
"details": {"name" : "Pankaj" , "email_id" :"abc@gmail.com"}
}
But unfortunately here insert into mongo like this:
{
"_id"…

panky
- 137
- 1
- 1
- 10
3
votes
1 answer
Play mongo Enumerator stops unexpectedly
Setup Scala 2.11.4, Playframework 2.3.7, Reacivemongo (0.10.5.0.akka23/0.11.0-SNAPSHOT tried with both).
We have a collection with 18'000 entities, processing this collection in asynchronous manner, using Enumerator/Iteratee approach.
Case…

mavarazy
- 7,562
- 1
- 34
- 60
3
votes
2 answers
Play reports that it can't get ClosableLazy value after it has been closed
I am trying to run specification test in Play/Scala/ReactiveMongo project. Setup is like this:
class FeaturesSpec extends Specification {
"Features controller" should {
"create feature from JSON request" in withMongoDb { app =>
// do…

Jarek Rozanski
- 780
- 1
- 6
- 13
3
votes
1 answer
Composing Futures with For Comprehension
I have a Play Framework application using ReactiveMongo with MongoDB, and I have the following code:
def categories(id: String): Future[Vector[Category]] = {...}
....
val categoriesFuture = categories(id)
for {
categories: Vector[Category] <-…

Vidya
- 29,932
- 7
- 42
- 70
3
votes
2 answers
Stream data from a Play Enumerator through Spray using Chunked Responses
I have data being pulled from Reactive Mongo that I need to push through a Spray Rest API. I had hoped to do this with Chunked Responses. However I have discovered that the Enumerator that comes back from Reactive Mongo is capable of pushing…

Wade
- 346
- 2
- 12
3
votes
1 answer
How to compare dates in a ReactiveMongo BSON query?
I'm using ReactiveMongo without the Play fremework.
I'm trying to write the equivalent of the following simple MongoDB query :
db.oplog.rs.find({"o.TimeCreated":{"$gt": ISODate("2014-09-30T10:00:00.000Z")}})
I've tried things like :
val query =…

user297112
- 99
- 1
- 4
3
votes
3 answers
Compile error on a Future[Option[BasicProfile]] method in play
i'm writing a play 2.3 application using secure social and reactivemongo library, with scala.
Now i'm trying to implement the UserService[T] trait but i'm getting compile errors on the updatePasswordInfo method.
This is the method:
def…

alberto adami
- 729
- 1
- 6
- 25