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

Method as_command

pymongo/message.py:1803–1827  ·  view source on GitHub ↗

Return a getMore command document for this query.

(
        self, conn: _AgnosticConnection, apply_timeout: bool = False
    )

Source from the content-addressed store, hash-verified

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

Callers 1

get_messageMethod · 0.95

Calls 5

_gen_get_more_commandFunction · 0.85
_apply_toMethod · 0.45
add_server_apiMethod · 0.45
send_cluster_timeMethod · 0.45
apply_timeoutMethod · 0.45

Tested by

no test coverage detected