com.github.cedrickring.reactormongodb.collection.flux.AggregateFlux.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.flux
import com.github.cedrickring.reactormongodb.collection.ReactiveCollection
import org.bson.conversions.Bson
import reactor.core.CoreSubscriber
import reactor.core.publisher.Flux
class AggregateFlux(private val reactiveCollection: ReactiveCollection,
private val pipeline: List,
private val resultClass: Class) : Flux() {
override fun subscribe(actual: CoreSubscriber?) {
reactiveCollection.nativeCollection.aggregate(pipeline, resultClass).forEach(
{ result -> actual?.onNext(result) },
{ _, throwable -> actual?.onError(throwable) }
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy