com.github.cedrickring.reactormongodb.collection.mono.InsertManyMono.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reactor-mongodb Show documentation
Show all versions of reactor-mongodb Show documentation
A wrapper above the mongodb-async api with Reactor (http://projectreactor.io/)
The newest version!
package com.github.cedrickring.reactormongodb.collection.mono
import com.github.cedrickring.reactormongodb.collection.ReactiveCollection
import com.mongodb.client.model.InsertManyOptions
import reactor.core.CoreSubscriber
import reactor.core.publisher.Mono
class InsertManyMono(private val reactiveCollection: ReactiveCollection,
private val documents: List,
private val insertManyOptions: InsertManyOptions) : Mono() {
override fun subscribe(actual: CoreSubscriber?) {
reactiveCollection.nativeCollection.insertMany(documents, insertManyOptions) { void, throwable ->
if (throwable == null) {
actual?.onNext(void)
} else {
actual?.onError(throwable)
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy