MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _do_batched_op_msg

Function _do_batched_op_msg

pymongo/message.py:908–926  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

906
907
908def _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
929class _ClientBulkWriteContext(_BulkWriteContextBase):

Callers 1

batch_commandMethod · 0.85

Calls 3

_batched_op_msgFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected