我正在使用play框架和mongo scala驱动程序来设置数据库,我需要将查询结果解析为Json以将其发送到前端:
def getAllProcess(userId: String) = {
getCollection(COMPANY_FORM).find(equal("userId", userId)).subscribe(new Observer[Document] {
override def onError(e: Throwable): Unit = println(e)
override def onComplete(): Unit = println("Complete")
override def onNext(result: Document): Unit = println(result)
})
}
如何解析其结果?