Execute all operations, returning no results (w=0).
(
self,
conn: AsyncConnection,
generator: Iterator[Any],
write_concern: WriteConcern,
)
| 690 | pass |
| 691 | |
| 692 | async def execute_no_results( |
| 693 | self, |
| 694 | conn: AsyncConnection, |
| 695 | generator: Iterator[Any], |
| 696 | write_concern: WriteConcern, |
| 697 | ) -> None: |
| 698 | """Execute all operations, returning no results (w=0).""" |
| 699 | if self.uses_collation: |
| 700 | raise ConfigurationError("Collation is unsupported for unacknowledged writes.") |
| 701 | if self.uses_array_filters: |
| 702 | raise ConfigurationError("arrayFilters is unsupported for unacknowledged writes.") |
| 703 | # Guard against unsupported unacknowledged writes. |
| 704 | unack = write_concern and not write_concern.acknowledged |
| 705 | if unack and self.uses_hint_delete and conn.max_wire_version < 9: |
| 706 | raise ConfigurationError( |
| 707 | "Must be connected to MongoDB 4.4+ to use hint on unacknowledged delete commands." |
| 708 | ) |
| 709 | if unack and self.uses_hint_update and conn.max_wire_version < 8: |
| 710 | raise ConfigurationError( |
| 711 | "Must be connected to MongoDB 4.2+ to use hint on unacknowledged update commands." |
| 712 | ) |
| 713 | if unack and self.uses_sort and conn.max_wire_version < 25: |
| 714 | raise ConfigurationError( |
| 715 | "Must be connected to MongoDB 8.0+ to use sort on unacknowledged update commands." |
| 716 | ) |
| 717 | # Cannot have both unacknowledged writes and bypass document validation. |
| 718 | if self.bypass_doc_val: |
| 719 | raise OperationFailure( |
| 720 | "Cannot set bypass_document_validation with unacknowledged write concern" |
| 721 | ) |
| 722 | |
| 723 | if self.ordered: |
| 724 | return await self.execute_command_no_results(conn, generator, write_concern) |
| 725 | return await self.execute_op_msg_no_results(conn, generator) |
| 726 | |
| 727 | async def execute( |
| 728 | self, |
no test coverage detected