All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.cedrickring.reactormongodb.collection.mono.InsertManyMono.kt Maven / Gradle / Ivy

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