【发布时间】:2016-01-15 16:16:42
【问题描述】:
我很想使用 reactiveMongo 来实现 CRUD 操作,这是我从在线教程中获得的查找功能。
def findTicker(ticker: String) = {
val query = BSONDocument("firstName" -> ticker)
val future = collection.find(query).one
future.onComplete {
case Failure(e) => throw e
case Success(result) => {
println(result)
}
}
}
但是我得到了这个结果:
Some(BSONDocument(<non-empty>))
我如何才能真正看到我正在寻找的实际可读 JSON 数据:
{ "_id" : ObjectId("569914557b85c62b49634c1d"), "firstName" : "Stephane", "lastName" : "Godbillon", "age" : 29 }
【问题讨论】:
-
BSONDocument.pretty(bsonDoc)
标签: scala playframework bson reactivemongo