insertMany

abstract suspend fun insertMany(documents: List<TDocument>): InsertManyResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

See also

Parameters

documents

the documents to insert

Throws

com.mongodb.MongoBulkWriteException

if there's an exception in the bulk write operation

com.mongodb.MongoException

if the write failed due some other failure


abstract suspend fun insertMany(documents: List<TDocument>, options: InsertManyOptions): InsertManyResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

See also

Parameters

documents

the documents to insert

options

the options to apply to the operation

Throws

com.mongodb.MongoBulkWriteException

if there's an exception in the bulk write operation

com.mongodb.MongoException

if the write failed due some other failure


abstract suspend fun insertMany(clientSession: ClientSession, documents: List<TDocument>): InsertManyResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Since

3.6

See also

Parameters

clientSession

the client session with which to associate this operation

documents

the documents to insert

Throws

com.mongodb.MongoBulkWriteException

if there's an exception in the bulk write operation

com.mongodb.MongoException

if the write failed due some other failure


abstract suspend fun insertMany(    clientSession: ClientSession,     documents: List<TDocument>,     options: InsertManyOptions): InsertManyResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Since

3.6

See also

Parameters

clientSession

the client session with which to associate this operation

documents

the documents to insert

options

the options to apply to the operation

Throws

com.mongodb.MongoBulkWriteException

if there's an exception in the bulk write operation

com.mongodb.MongoException

if the write failed due some other failure