0

My relevant imports are:

import play.api.libs.concurrent.Execution.Implicits._
import play.api.libs.json.Jsonimport play.modules.reactivemongo.json._
import play.modules.reactivemongo.ReactiveMongoApi
import play.modules.reactivemongo.json.collection.JSONCollection
import reactivemongo.api.commands.WriteResult
import reactivemongo.extensions.json.dao.JsonDao
import reactivemongo.extensions.json.dsl.JsonDsl._

The code which causes problem is

myCollection.find(Json.obj("email" -> email)).one 

gives ambiguous implicit values: both object BSONDoubleFormat in trait BSONFormats of type play.modules.reactivemongo.json.BSONDoubleFormat.type and object BSONStringFormat in trait BSONFormats of type play.modules.reactivemongo.json.BSONStringFormat.type match expected type play.api.libs.json.Reads[T] myCollection.find(Json.obj("email" -> email)).one

As I understand I need to somehow define which format object should be used. But I don't understand how this can be done. The other problem is that I'm using JSON objects not BSON's to store data in Mongo, thus I don't understand why it is complaining BSONDoubleFormat & BSONStringFormat objects.

cchantep
  • 9,118
  • 3
  • 30
  • 41

1 Answers1

0

If you look at the documentation and examples, you can see that the function is .one[T], not .one.

As you don't indicate the result type T, it cannot compile.

myCollection.find(Json.obj("email" -> email)).one[T]
cchantep
  • 9,118
  • 3
  • 30
  • 41