Questions tagged [reactivemongo-play-json]

12 questions
4
votes
1 answer

Warnings following upgrade of play2-reactivemongo from version 0.18.4 to 0.19.5

We are developing an application based on Play Framework (Scala) and storing data into a Mongo database using ReactiveMongo. After upgrading play2-reactivemongo from version 0.18.4 to 0.19.5, we obtain a lot of deprecation warnings and I can…
2
votes
0 answers

BSON to Play JSON support for Long values

I've started using the play-json/play-json-compat libraries with reactivemongo 0.20.11. So I can use JSON Play reads/writes while importing the 'reactivemongo.play.json._' package and then easily fetch data from a JSONCollection instead of a…
2
votes
0 answers

How do I resolve ReactiveMongo 20.3 console warning?

On updating from "org.reactivemongo" %% "play2-reactivemongo" % "0.16.6-play26" to "org.reactivemongo" %% "play2-reactivemongo" % "0.20.3-play27" I get the following warnings which I'm not sure how to handle. package object json in package json is…
1
vote
1 answer

Does ReactiveMongo handle extended JSON to BSON conversion fully?

I have been trying to use reactivemongo to insert some documents into a mongodb collection with a few BSON types. I am using the Play JSON library to parse and manipulate some documents in extended JSON, here is one example: { "_id" : {"$oid":…
Florentin Hennecker
  • 1,974
  • 23
  • 37
1
vote
0 answers

Transforming ReactiveMongo JSON with Play JSON

ReactiveMongo's JSON functionality generates objects (JsObject in play-json parlance) rather than scalars for certain MongoDB datatypes like BSONObjectID and BSONDateTime. For example, you get JSON like this: { "_id" : { "$oid" :…
Vidya
  • 29,932
  • 7
  • 42
  • 70
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…
0
votes
1 answer

How to store date/time with ReactiveMongo + Play Json into mongodb

I'm trying to store java.time.Instant in mongo's native Date format. Official ReactiveMongo documentation states that date time should be serialized as JsObject with a $date JsNumber field with the timestamp (milliseconds) as…
Teimuraz
  • 8,795
  • 5
  • 35
  • 62
0
votes
1 answer

ReactiveMongo with Play-json responsibility's division

I'm using play-json to serialize my incoming jsons to case classes, for example from sqs source, or from api calls. its a very simple class JsonSerialization that I import where I need it: object JsonSerialization { implicit val StatusFormat:…
0
votes
0 answers

How to use $in mongo query with ReactiveMongo in Play! Framework 2.6?

I am trying to use the following find query, { "uid" : { "$in" : ["value1", "value2"] } } The array ["value1", "value2"] should be set dynamically from Scala Array[String]. Here is my code, def find(uids: Array[String]): Future[Seq[User]] =…
0
votes
0 answers

Execution error when mapping from a MongoDB embedded document

Suppose I am trying to output an embedded field from a mongoDB (using the Play Framework 2.6 - in JSON). A typical document looks like this: _id : ObjectId("66bc9c788c788cafdb053a23"), name : "Name game" myFieldArr : [ { …
0
votes
2 answers

Aggregate data in ReactiveMongo matching by date

I am trying to get an aggregate in ReactiveMongo 0.12 and Play Framework 2.6 (using JSON collections - not BSON) by filtering dates from a collection called "visitors". A typical document may look like this: { "_id":…
-1
votes
1 answer

How can I see how many documents were written & handle errors correctly?

From the documentation I can see that I should be able to use WriteResult.ok, WriteResult.code and WriteResult.n in order to understand errors and the number of updated documents but this isn't working. Here is a sample of what I'm doing (using…