I am going to use ReactiveMongo in Play filter, How can i do this?
I can only find sample for using ReactiveMongo in Controller. How can i access to db.collection in a Play filter?
I am going to use ReactiveMongo in Play filter, How can i do this?
I can only find sample for using ReactiveMongo in Controller. How can i access to db.collection in a Play filter?
Thanks to Stéphane Godbillon for his answer in ReactiveMongo google group:
You can call the
connection
on the objectReactiveMongoPlugin
(in the package play.modules.reactivemongo) in your filter.
val connection = ReactiveMongoPlugin.connection(play.api.Play.current)
val db = connection("your-db")
def collection: JSONCollection = db.collection[JSONCollection]("your-collection")