MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / use_command

Method use_command

pymongo/message.py:1622–1636  ·  view source on GitHub ↗
(self, conn: _AgnosticConnection)

Source from the content-addressed store, hash-verified

1620 return f"{self.db}.{self.coll}"
1621
1622 def use_command(self, conn: _AgnosticConnection) -> bool:
1623 use_find_cmd = False
1624 if not self.exhaust:
1625 use_find_cmd = True
1626 elif conn.max_wire_version >= 8:
1627 # OP_MSG supports exhaust on MongoDB 4.2+
1628 use_find_cmd = True
1629 elif not self.read_concern.ok_for_legacy:
1630 raise ConfigurationError(
1631 "read concern level of %s is not valid "
1632 "with a max wire version of %d." % (self.read_concern.level, conn.max_wire_version)
1633 )
1634
1635 conn.validate_session(self.client, self.session) # type: ignore[arg-type]
1636 return use_find_cmd
1637
1638 def update_command(self, cmd: dict[str, Any]) -> None:
1639 self._as_command = cmd, self.db

Callers 4

use_commandMethod · 0.45
use_commandMethod · 0.45
run_operationMethod · 0.45
run_operationMethod · 0.45

Calls 2

ConfigurationErrorClass · 0.90
validate_sessionMethod · 0.45

Tested by

no test coverage detected