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

Class _Run

pymongo/bulk_shared.py:44–69  ·  view source on GitHub ↗

Represents a batch of write operations.

Source from the content-addressed store, hash-verified

42
43
44class _Run:
45 """Represents a batch of write operations."""
46
47 def __init__(self, op_type: int) -> None:
48 """Initialize a new Run object."""
49 self.op_type: int = op_type
50 self.index_map: list[int] = []
51 self.ops: list[Any] = []
52 self.idx_offset: int = 0
53
54 def index(self, idx: int) -> int:
55 """Get the original index of an operation in this run.
56
57 :param idx: The Run index that maps to the original index.
58 """
59 return self.index_map[idx]
60
61 def add(self, original_index: int, operation: Any) -> None:
62 """Add an operation to this Run instance.
63
64 :param original_index: The original index of this operation
65 within a larger bulk operation.
66 :param operation: The operation document.
67 """
68 self.index_map.append(original_index)
69 self.ops.append(operation)
70
71
72def _merge_command(

Callers 4

gen_orderedMethod · 0.90
gen_unorderedMethod · 0.90
gen_orderedMethod · 0.90
gen_unorderedMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected