Play-ReactiveMongo is a plugin for Play 2.x, enabling support for ReactiveMongo – reactive, asynchronous and non-blocking Scala driver for MongoDB.
Questions tagged [play-reactivemongo]
148 questions
0
votes
0 answers
Reactive Mongo & Play Patterns: Handling Unit/No records
I am using ReactiveMongo with PlayFramework and have the following code in my DAO:
def find(authType: AuthType.Value, authAccountId: String) =
collection.find(
Json.obj(Fields.AuthType → authType,
Fields.AuthAccountId →…

MojoJojo
- 3,897
- 4
- 28
- 54
0
votes
1 answer
How to create a custom BSON Reader/Writer for nested and referenced documents?
I am using play2-reactivemongo version 0.11.11 and reactivemongo-play-json. I have the following class:
case class Player(
id: Option[String],
profiles: List[Profile],
teams: List[Team],
…

John Doe
- 275
- 3
- 12
0
votes
1 answer
BSONObjectIDFormat in trait BSONFormats is deprecated
I am using Reactive Mongo version 0.11.11 and I want to implement a method in my DAO which counts all documents by _id.
Here is my DAO:
import com.google.inject.Inject
import models.auth.{Team, Player}
import…

John Doe
- 275
- 3
- 12
0
votes
0 answers
How to add a partialFilterExpression to an index using reactiveMongo and play
I am trying to add an unique index to a field to a document where the collection has several different kinds of documents. I would like to use a partialFilterExpression to filter out unwanted documents and only apply the index to the documents I…

user1584120
- 1,169
- 2
- 23
- 44
0
votes
1 answer
How to count documents with query in ReactiveMongo with Play's JSON library?
Let's consider I have a collection users that have the age attribute. Now I want to count either all documents in the collection users or only the ones which match the age attribute. So, I did the following:
def count(age: Option[Int] = None) = {
…

John Doe
- 275
- 3
- 12
0
votes
1 answer
No Json serializer as JsObject found for type reactivemongo.play.json.JSONSerializationPack.type
I am using play framework 2.5.3 with reactive mongoDB.
import javax.inject._
import model._
import play.api.Logger
import play.api.libs.json._
import play.api.mvc._
import play.modules.reactivemongo._
import reactivemongo.api.ReadPreference
import…

Peter.M
- 13
- 4
0
votes
1 answer
No data inserted during start of Play application (using Play 2.4 and reactivemongo 11.11)
We're using Play Framework 2.4 with mongodb 2.6. But since we migrated reactivemongo from 0.11.10 to 0.11.11-play24, something is wrong.
We're loading some data into mongodb during the start of the application. Everything looks fine, the application…

ersefuril
- 809
- 9
- 16
0
votes
1 answer
Can I run mongo js scripts from reactivemongo
Stack: Scala 2.11.8, ReactiveMongo 0.11.10, Playframework 2.4.6
We manage mongo update scripts through mongo scripts, which we manually apply on each update. I want to automate this process and make this part of startup process in Play, but it seems…

mavarazy
- 7,562
- 1
- 34
- 60
0
votes
1 answer
Perform 2 operations to update on ReactiveMongo
I am testing the next 2 query on mongo shell an it works,
But now, I need to perform the same query in reactivemongo
Someone can give me a suggestion for how to make the query in reactivemongo
doc = db.offer.find({"_id":…

Sanx
- 223
- 1
- 6
- 17
0
votes
1 answer
Get an error message while tring to rewrite ReactiveMongo + BSON to JSON in Play Framework
I tried to use Json library to replace Bson library.
This is the original code which works.
case class City(name: String, population: Int)
object City {
implicit val reader = Macros.reader[City]
}
@Singleton
class CityController @Inject()(val…

Roger Chien
- 344
- 3
- 13
0
votes
1 answer
Basic Create-from-Json Method Walkthrough
I'm new to play, scala, and reactivemongo and was wondering if someone could explain to me the following code in easy terms to understand.
def createFromJson = Action.async(parse.json) { request =>
import play.api.libs.json.Reads._
val transformer:…

Jeff
- 211
- 3
- 11
0
votes
0 answers
Insert document with ReactiveMongo does not use BSONWriter or Reader
I have the following class:
case class DeviceRegistration(deviceData: DeviceData,
pin: String,
created: DateTime) {}
Type DeviceData is defined simply as 4 string fields.
I've been trying…

redwulf
- 1,317
- 3
- 13
- 35
0
votes
1 answer
Cannot invoke the action, eventually got an error: java.lang.IllegalArgumentException: Only JsObjects can be stored in Play framework?
I am new to Reactivemongo database(2.6), as I am trying to upload/insert json object(which is of key/value pairs, I am sending it to store in database after clicking of Submit button from my UI ) from my localsystem to store in Mongodb using Play…

Dhana
- 711
- 3
- 14
- 40
0
votes
1 answer
How should I use JSONFindAndModifyCommand?
I have no idea how I should use play-reactivemongo's JSONFindAndModifyCommand.
I need to make an upsert query by some field. So I can first remove any existing entry and then insert. But Google says that FindAndModify command has upsert: Boolean…

iTollu
- 999
- 13
- 20
0
votes
2 answers
Instantiate a val from a given @inject class
How do I instantiate an object from this class? I have another class where I would like to use the MongoUtils class as defined below. This class is from reactivemongo
package controllers
import javax.inject.Inject
import…

summerNight
- 1,446
- 3
- 25
- 52