Create a replace document and add it to the list of ops.
(
self,
selector: Mapping[str, Any],
replacement: Mapping[str, Any],
upsert: Optional[bool],
collation: Optional[Mapping[str, Any]] = None,
hint: Union[str, dict[str, Any], None] = None,
sort: Optional[Mapping[str, Any]] = None,
)
| 170 | self.ops.append((_UPDATE, cmd)) |
| 171 | |
| 172 | def add_replace( |
| 173 | self, |
| 174 | selector: Mapping[str, Any], |
| 175 | replacement: Mapping[str, Any], |
| 176 | upsert: Optional[bool], |
| 177 | collation: Optional[Mapping[str, Any]] = None, |
| 178 | hint: Union[str, dict[str, Any], None] = None, |
| 179 | sort: Optional[Mapping[str, Any]] = None, |
| 180 | ) -> None: |
| 181 | """Create a replace document and add it to the list of ops.""" |
| 182 | validate_ok_for_replace(replacement) |
| 183 | cmd: dict[str, Any] = {"q": selector, "u": replacement} |
| 184 | if upsert is not None: |
| 185 | cmd["upsert"] = upsert |
| 186 | if collation is not None: |
| 187 | self.uses_collation = True |
| 188 | cmd["collation"] = collation |
| 189 | if hint is not None: |
| 190 | self.uses_hint_update = True |
| 191 | cmd["hint"] = hint |
| 192 | if sort is not None: |
| 193 | self.uses_sort = True |
| 194 | cmd["sort"] = sort |
| 195 | self.ops.append((_UPDATE, cmd)) |
| 196 | |
| 197 | def add_delete( |
| 198 | self, |
nothing calls this directly
no test coverage detected