有没有一个好的库可以让 Kotlin Coroutines 异步访问 Mongo?

Is there a good library for Kotlin Coroutines to access Mongo asyncly?

我正在 JVM 中开始一个新项目,它有很多 IO。在某些时候,我必须在 Mongo 数据库中保存一些东西。我的想法是对 Kotlin 协程使用非阻塞方法。

我知道 Mongo 有一个官方的 react 流驱动程序并且支持看起来不错。但在这种情况下,我需要在流和协程之间 "create bridges"。我的问题是关于这一点:有没有人知道更好或更简单的方法?

查看 KMongo project. It has 协程支持:

import org.litote.kmongo.reactivestreams.*  //NEEDED! import KMongo reactivestreams extensions
import org.litote.kmongo.coroutine.* //NEEDED! import KMongo coroutine extensions

data class Jedi(val name: String, val age: Int)

val client = KMongo.createClient().coroutine //use coroutine extension
val database = client.getDatabase("test") //normal java driver usage
val col = database.getCollection<Jedi>() //KMongo extension method

//async now
runBlocking {
    col.insertOne(Jedi("Luke Skywalker", 19))

    val yoda : Jedi? = col.findOne(Jedi::name eq "Yoda")

    (...)
}