Questions tagged [reactivemongo]

Asynchronous & Non-Blocking Scala Driver for MongoDB

508 questions
0
votes
1 answer

Remove case class field before storing to MongoDB

I'm writing a generic update method to simplify save an case class change to mongodb. my model T trait has the following function: def update(id: BSONObjectID, t: T)(implicit writer: OFormat[T]): Future[WriteResult] = { …
0
votes
1 answer

How to use ReactiveMongoDB and doc.getAs with a complex object?

I am working with the Play framework and ReactiveMongoDB. I am trying to write a reader and a writer for my class called Customer. This is all being done in the models.scala file in the following order: import reactivemongo.bson._ case class…
pitchblack408
  • 2,913
  • 4
  • 36
  • 54
0
votes
2 answers

Should I be creating a singleton MongoDriver object in Scala using the Reactivemongo driver?

I have the following singleton object which has a static method called connect which returns a DB connection. In classical synchronous programming I am understood to believe that you only ever want one instance of a connection however this seems at…
Faktor 10
  • 1,868
  • 2
  • 21
  • 29
0
votes
2 answers

Play-ReactiveMongo plugin: play2 testing a controller with a reactiveMongoApi

In the following, I am using the Play2 ReactiveMongo plugin in version 0.11.0.play24 (https://github.com/ReactiveMongo/Play-ReactiveMongo) for Play 2.4. As mentioned in the documentation located at…
user3439701
0
votes
1 answer

play reactivemongo error after upgrade to 0.11.0

I just upgraded play reactivemongo from 0.10.5.0.AKKA23 to 0.11.0.play24. However, i got the following error with the code which compiles fine before the upgrade. val gridFS = new GridFS(db) val file = gridFS.find(BSONDocument("filename" -> new…
vaj oja
  • 1,151
  • 2
  • 16
  • 47
0
votes
1 answer

How can I find a play form type (for handling post requests in controller) in order to map a class containing BSONObjectID type?

I'm working on a web application using Play Framework (2.2.6) / scala / mongoDB, and I have a problem with reactivemongo.bson.BSONObjectID. (I'm a beginner in both ReactiveMongo and Scala) My controller contains this code : val actForm =…
Xan
  • 65
  • 6
0
votes
2 answers

ReactiveMongo: Unable to remove document from array using Reactive Mongo Query DSL

I am trying to remove document from array using reactive mongo Query DSL. My document structure is as below: { "_id" : ObjectId("55950666c3ad8c860b5141cc"), "name" : "Texla", ------------------------- "location" : { "_id" :…
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
0
votes
1 answer

ReactiveMongo + Play 2: stream a sub document (array)

In the following example, I am using: MongoDB (> 3.0 with WiredTiger engine) Play framework 2.3.8 in Scala The org.reactivemongo:play2-reactivemongo:0.11.0.play23-M3 First of all, suppose we have the following document in a MongoDB collection…
user3439701
0
votes
0 answers

ReactiveMongo: Projection element not return using reactive mongo query

i have following mongodb document: { "_id" : ObjectId("5592c0e6ea16e552ac90e169"), ----------- "location" : { "_id" : ObjectId("5592c17fc3ad8cbffa0e9778"), "companyFieldId" : ObjectId("559140f1ea16e552ac90e058"), "name" : "Location", …
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
0
votes
1 answer

Which one is better to be used at Http server, Casbah or ReactiveMongo?

I want to start a MongoDB database for my project and I'm a Scala user, but I couldn't find a good comparison between these two Scala frameworks for MongoDB, what are their main differences, supports and other aspects?
Omid
  • 1,959
  • 25
  • 42
0
votes
1 answer

Reactivemongo getAsTry is not a member of PasswordInfo

I'm working on a project to integrate play silhouette with reactivemongo When I compile my project shows me an error like this: [error] /reactivemongo-silhouette-rest/app/models/daos/PasswordInfoDAO.scala:83: value getAsTry is not a member of…
Sanx
  • 223
  • 1
  • 6
  • 17
0
votes
2 answers

Get newly inserted document BSONObjectID

i need to return newly inserted object. I read that i can generate my own id but that's not probably the case. def create(repo: String) = Action.async(parse.json) { implicit req => val id = BSONObjectID.generate …
Haito
  • 2,039
  • 1
  • 24
  • 35
0
votes
1 answer

Import implicit variable for generic class from implementation

I have an issue in Scala I'm really stuck on. I know the title is probably more confusing so let me try to explain it as easy as possible. Imagine I have an abstract class called Repo. This class describes a couple of methods on them, most of them…
Martijn
  • 2,268
  • 3
  • 25
  • 51
0
votes
1 answer

Play + ReactiveMongo: capped collection and tailable cursor

I'm using Play Framework with Scala, Akka and ReactiveMongo. I want to use a collection in MongoDB as a circular queue. Several actors can insert documents into it; one actor retrieves these documents as soon as they're available (a sort of…
0
votes
1 answer

ReactiveMongo: How to use the $in operator with _id

Let's suppose we need to find a user whose id is 5546329b470000850084a622: val selector = Json.parse("""{"_id":{"$oid":"5546329b470000850084a622"}}""") users.find(selector).map { ... } The equivalent from the Mongo shell would be db.users.find(…
j3d
  • 9,492
  • 22
  • 88
  • 172