Questions tagged [play-reactivemongo]

Play-ReactiveMongo is a plugin for Play 2.x, enabling support for ReactiveMongo – reactive, asynchronous and non-blocking Scala driver for MongoDB.

148 questions
1
vote
1 answer

Scala - Play Framework - Reactive Mongo - Service Layer

Is there a way to use reactiveMongoApi in the service layer. I have tried creating a class and tried to create a collection with the following syntax. def collection = reactiveMongoApi.database.map( _.collection[JSONCollection]("persons")); But it…
Pavan Andhukuri
  • 1,547
  • 3
  • 23
  • 49
1
vote
3 answers

"\" and \"" added when adding documents from Json to mongo DB

my json looks like this. [ {"name": "AABC Register Ltd (Architects accredited in building conservation), with effect from the 2016 to 2017 tax year"}, {"name": "Academic and Research Surgery Society of"}, {"name": "Academic Gaming and…
1
vote
2 answers

Push object into array if exists(checking by field) otherwise set object in MongoDB

This is the document I currently have: { "_id" : ObjectId("5adef141502f49a6a2812016"), "productId" : "123456", "users" : [ { "userId" : "1111111", "internalUserId" : "azxcvdd" }, { …
1
vote
0 answers

MongoController with Play

I am using Play! Framework with current version and i am trying to integrate with MongoDB via ReactiveMongo, but I am getting following error "illegal inheritance; superclass Object is not a subclass of the superclass AbstractController of the mixin…
1
vote
0 answers

ReactiveMongo aggregate function

I'm trying to convert the following mongo query to Reactive Mongo Equivalent ( JSON ) db.media.aggregate( {$group : { "_id" : "$createdBy", "count" : { $sum : 1 }}}, {$sort : {"count" : -1}}, {$limit : 10} ) What I have come up with is this,…
1
vote
0 answers

Play 2.3 with ReactiveMongo to serialize JsObject

I have a case class like this: case class MemberOptions( @Key("_id") memberId: Long, settingsJson: JsObject, updateDate: DateTime = DateTime.now() ) How can I serialize and deserialize JsObject? I tried to look for Writes and Reads but found…
1
vote
1 answer

ReactiveMongoModule cannot be instantiated

Not sure what is happening, everything compiles fine, but when I run the project it fails. I have imported reactivemongo in build.sbt and I have the below enabled in my application.conf file. I am using play 2.5.10 play.modules.enabled +=…
1
vote
0 answers

Updating nested array inside array using reactivemongo

I'm trying to update an element in nested lists with scala and reactive mongo. I tried this: def updatethirdList(secondListElementId: UUID, firstObject: FirstObject): Future[Either[String, UUID]] = { val query =…
Rajeun
  • 721
  • 2
  • 12
  • 37
1
vote
0 answers

Connecting Database in Play framework

I have done the following things => controllers.Application object Application extends Controller { val studentForm = Form( mapping( "FirstName" -> text, "MiddleName" -> text, "LastName" -> text, "RollNumber" ->…
AAA
  • 354
  • 1
  • 3
  • 14
1
vote
1 answer

How to use aggregate with ReactiveMongo

So, I need to sort my collection on MongoDB by fields that are on an array of objects. I have "columns": [{ "kind": "FirstKind", "descriptor": "Description1", "data": "Data to be sorted" },{ "kind": "SecondKind", "descriptor":…
1
vote
1 answer

Play-Framework: Cannot parse parameter companyId as BSONObjectID: wrong ObjectId

I am using play-framework with Reactive mongo drivers. For handling reactive mongo BSONObjectId in our routes file, i am creating following binders: object StringToBSONObjectIdBinder { /* This is for Path Parameter*/ implicit object…
1
vote
1 answer

Idiomatic way of getting a collection in ReactiveMongo

I'm writing a Play/Scala application using Play 2.5.4 and ReactiveMongo. Based on this example, I'm getting the collection using class SettingStore( val mongo:ReactiveMongoApi) { def collection = mongo.db.collection[BSONCollection]("Settings") …
Michael Bar-Sinai
  • 2,729
  • 20
  • 27
1
vote
0 answers

How to replace current with DI in ReactiveMongo 0.11.11 & Play 2.5

I used the DAO design GitHub Gist by almeidap as an example for my database layer. Unfortunately, current is deprecated since the Play release 2.5, so I can't use: trait MongoHelper extends ContextHelper{ lazy val db =…
1
vote
0 answers

Play Reactivemongo update only one key

I want to update only one key in an document with a particular ID. { "_id" : ObjectId("5755b80229d52a2e4bca4264"), "ID" : 1, "Entity_name" : "Basic Risk", "Risk_name" : "Sample Risk", "Parameters" : "ABCD", "configurations" :…
aman kharb
  • 11
  • 1
1 2
3
9 10