kmongo / org.litote.kmongo.coroutine / com.mongodb.async.client.MongoCollection / insertMany

insertMany

suspend fun <T : Any> MongoCollection<T>.insertMany(documents: List<T>, options: InsertManyOptions = InsertManyOptions()): Void? (source)

Inserts one or more documents. A call to this method is equivalent to a call to the {@code bulkWrite} method

Parameters

documents - the documents to insert

options - the options to apply to the operation

Exceptions

com.mongodb.MongoBulkWriteException - if there's an exception in the bulk write operation

com.mongodb.MongoException - if the write failed due some other failure

See Also

com.mongodb.async.client.MongoCollection

suspend fun <T : Any> MongoCollection<T>.insertMany(clientSession: ClientSession, documents: List<T>, options: InsertManyOptions = InsertManyOptions()): Void? (source)

Inserts one or more documents. A call to this method is equivalent to a call to the {@code bulkWrite} method

Parameters

clientSession - the client session with which to associate this operation

documents - the documents to insert

options - the options to apply to the operation

Exceptions

com.mongodb.MongoBulkWriteException - if there's an exception in the bulk write operation

com.mongodb.MongoException - if the write failed due some other failure

See Also

com.mongodb.async.client.MongoCollection