Create the next batched insert, update, or delete operation using OP_MSG.
(
namespace: str,
operation: int,
command: MutableMapping[str, Any],
docs: list[Mapping[str, Any]],
opts: CodecOptions[Any],
ctx: _BulkWriteContext,
)
| 906 | |
| 907 | |
| 908 | def _do_batched_op_msg( |
| 909 | namespace: str, |
| 910 | operation: int, |
| 911 | command: MutableMapping[str, Any], |
| 912 | docs: list[Mapping[str, Any]], |
| 913 | opts: CodecOptions[Any], |
| 914 | ctx: _BulkWriteContext, |
| 915 | ) -> tuple[int, bytes, list[Mapping[str, Any]]]: |
| 916 | """Create the next batched insert, update, or delete operation |
| 917 | using OP_MSG. |
| 918 | """ |
| 919 | command["$db"] = namespace.split(".", 1)[0] |
| 920 | if "writeConcern" in command: |
| 921 | ack = bool(command["writeConcern"].get("w", 1)) |
| 922 | else: |
| 923 | ack = True |
| 924 | if ctx.conn.compression_context: |
| 925 | return _batched_op_msg_compressed(operation, command, docs, ack, opts, ctx) |
| 926 | return _batched_op_msg(operation, command, docs, ack, opts, ctx) |
| 927 | |
| 928 | |
| 929 | class _ClientBulkWriteContext(_BulkWriteContextBase): |
no test coverage detected