Reputation: 1161
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 BSONString(name)))
serve(gridFS).map(_.withHeaders(CONTENT_DISPOSITION -> "inline;"))
Error Message
[error] required: reactivemongo.api.gridfs.GridFS[play.modules.reactivemongo.json.JSONSerializationPack.type]
[error] serve(gridFS).map(_.withHeaders(CONTENT_DISPOSITION -> "inline;"
Upvotes: 0
Views: 115
Reputation: 9168
The new plugin 0.11 is providing ReactiveMongo API with the JSONSerializationPack (allowing to work with JSON valued in coast to coast approach).
Thus the serve
action in the Play Mongo controller is working with a GridFS API using this same JSON serialization (and expect JsValue
/JsObject
but not BSONValue
/BSONDocument
).
First step is to use the reactiveMongoApi.gridFS
instead a the new GridFS
(considering reactiveMongoApi
being the API instance resolved as indicated in the documentation). The GridFS instance is properly initialized for the use with JSON.
Then the query selector must be updated from BSONDocument
to Json.obj
.
An example can be found in the sample app.
Upvotes: 0