bulkWrite

fun bulkWrite(models: List<ClientNamespacedWriteModel>): ClientBulkWriteResult

Executes a client-level bulk write operation. This method is functionally equivalent to bulkWrite(models, options) with the default options.

This operation supports retryable writes. Depending on the number of models, encoded size of models, and the size limits in effect, executing this operation may require multiple bulkWrite commands. The eligibility for retries is determined per each bulkWrite command: ClientNamespacedUpdateManyModel, ClientNamespacedDeleteManyModel in a command render it non-retryable.

This operation is not supported by MongoDB Atlas Serverless instances.

Return

The ClientBulkWriteResult if the operation is successful.

Since

5.3

Parameters

models

The individual write operations.

See also

Throws

ClientBulkWriteException

If and only if the operation is unsuccessful or partially unsuccessful, and there is at least one of the following pieces of information to report: ClientBulkWriteException.getWriteConcernErrors, ClientBulkWriteException.getWriteErrors, ClientBulkWriteException.getPartialResult.

MongoException

Only if the operation is unsuccessful.


fun bulkWrite(models: List<ClientNamespacedWriteModel>, options: ClientBulkWriteOptions): ClientBulkWriteResult

Executes a client-level bulk write operation.

This operation supports retryable writes. Depending on the number of models, encoded size of models, and the size limits in effect, executing this operation may require multiple bulkWrite commands. The eligibility for retries is determined per each bulkWrite command: ClientNamespacedUpdateManyModel, ClientNamespacedDeleteManyModel in a command render it non-retryable.

This operation is not supported by MongoDB Atlas Serverless instances.

Return

The ClientBulkWriteResult if the operation is successful.

Since

5.3

Parameters

models

The individual write operations.

options

The options.

See also

Throws

ClientBulkWriteException

If and only if the operation is unsuccessful or partially unsuccessful, and there is at least one of the following pieces of information to report: ClientBulkWriteException.getWriteConcernErrors, ClientBulkWriteException.getWriteErrors, ClientBulkWriteException.getPartialResult.

MongoException

Only if the operation is unsuccessful.


fun bulkWrite(clientSession: ClientSession, models: List<ClientNamespacedWriteModel>): ClientBulkWriteResult

Executes a client-level bulk write operation. This method is functionally equivalent to bulkWrite(clientSession, models, options) with the default options.

This operation supports retryable writes. Depending on the number of models, encoded size of models, and the size limits in effect, executing this operation may require multiple bulkWrite commands. The eligibility for retries is determined per each bulkWrite command: ClientNamespacedUpdateManyModel, ClientNamespacedDeleteManyModel in a command render it non-retryable.

This operation is not supported by MongoDB Atlas Serverless instances.

Return

The ClientBulkWriteResult if the operation is successful.

Since

5.3

Parameters

clientSession

The client session with which to associate this operation.

models

The individual write operations.

See also

Throws

ClientBulkWriteException

If and only if the operation is unsuccessful or partially unsuccessful, and there is at least one of the following pieces of information to report: ClientBulkWriteException.getWriteConcernErrors, ClientBulkWriteException.getWriteErrors, ClientBulkWriteException.getPartialResult.

MongoException

Only if the operation is unsuccessful.


fun bulkWrite(clientSession: ClientSession, models: List<ClientNamespacedWriteModel>, options: ClientBulkWriteOptions): ClientBulkWriteResult

Executes a client-level bulk write operation.

This operation supports retryable writes. Depending on the number of models, encoded size of models, and the size limits in effect, executing this operation may require multiple bulkWrite commands. The eligibility for retries is determined per each bulkWrite command: ClientNamespacedUpdateManyModel, ClientNamespacedDeleteManyModel in a command render it non-retryable.

This operation is not supported by MongoDB Atlas Serverless instances.

Return

The ClientBulkWriteResult if the operation is successful.

Since

5.3

Parameters

clientSession

The client session with which to associate this operation.

models

The individual write operations.

options

The options.

See also

Throws

ClientBulkWriteException

If and only if the operation is unsuccessful or partially unsuccessful, and there is at least one of the following pieces of information to report: ClientBulkWriteException.getWriteConcernErrors, ClientBulkWriteException.getWriteErrors, ClientBulkWriteException.getPartialResult.

MongoException

Only if the operation is unsuccessful.