kmongo / org.litote.kmongo.coroutine / CoroutineCollection / insertMany

insertMany

suspend fun insertMany(documents: List<T>, options: InsertManyOptions = InsertManyOptions()): InsertManyResult (source)

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

Parameters

documents - the documents to insert

options - the options to apply to the operation com.mongodb.DuplicateKeyException or com.mongodb.MongoException

suspend fun insertMany(clientSession: ClientSession, documents: List<T>, options: InsertManyOptions = InsertManyOptions()): InsertManyResult (source)

Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

Parameters

clientSession - the client session with which to associate this operation

documents - the documents to insert

options - the options to apply to the operation com.mongodb.DuplicateKeyException or com.mongodb.MongoException

Mongodb
.server.release 3.6

Since
1.7