Return a getMore command document for this query.
(
self, conn: _AgnosticConnection, apply_timeout: bool = False
)
| 1801 | self._as_command = cmd, self.db |
| 1802 | |
| 1803 | def as_command( |
| 1804 | self, conn: _AgnosticConnection, apply_timeout: bool = False |
| 1805 | ) -> tuple[dict[str, Any], str]: |
| 1806 | """Return a getMore command document for this query.""" |
| 1807 | # See _Query.as_command for an explanation of this caching. |
| 1808 | if self._as_command is not None: |
| 1809 | return self._as_command |
| 1810 | |
| 1811 | cmd: dict[str, Any] = _gen_get_more_command( |
| 1812 | self.cursor_id, |
| 1813 | self.coll, |
| 1814 | self.ntoreturn, |
| 1815 | self.max_await_time_ms, |
| 1816 | self.comment, |
| 1817 | conn, |
| 1818 | ) |
| 1819 | if self.session: |
| 1820 | self.session._apply_to(cmd, False, self.read_preference, conn) # type: ignore[arg-type] |
| 1821 | conn.add_server_api(cmd) |
| 1822 | conn.send_cluster_time(cmd, self.session, self.client) # type: ignore[arg-type] |
| 1823 | # Support CSOT |
| 1824 | if apply_timeout: |
| 1825 | conn.apply_timeout(self.client, cmd=None) # type: ignore[arg-type] |
| 1826 | self._as_command = cmd, self.db |
| 1827 | return self._as_command |
| 1828 | |
| 1829 | def get_message( |
| 1830 | self, dummy0: Any, conn: _AgnosticConnection, use_cmd: bool = False |
no test coverage detected