Hello Stephane, list,
I have managed to update my old Play application to use 0.12 properly and the new future-database approach is very welcome but there is one deprecation message that I can't get rid of. Would you mind having a look and telling me what I've missed?
In ordinary retrieval code like this:
database.flatMap { (db: DefaultDB) ⇒
val collection: BSONCollection = db.collection(collection_name)
val futureNotificationList = collection.find(query).sort(sort).cursor[Notice]().collect[List]()
futureNotificationList.map { (notifications: List[Notice]) =>
Ok(Json.toJson(notifications)).withHeaders("Access-Control-Allow-Origin" -> "*")
}
}
I get the new warning
Symbol "collect" is deprecated. Use `collect` with an [[Cursor.ErrorHandler]]
The
find documentation still uses this deprecated form and I am having trouble passing an ErrorHandler. The code comments suggest a signature like this:
val futureNotificationList = cursor.collect[List](100, Cursor.FailOnError())
But that doesn't work at all. I must be missing a scala idiom. Any advice would be greatly appreciated.
thanks,
Will
ps. Play 2.5.10, Scala 2.11.8, ReactiveMongo 0.12.1