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

Method send_message

pymongo/asynchronous/pool.py:433–448  ·  view source on GitHub ↗

Send a raw BSON message or raise ConnectionFailure. If a network exception is raised, the socket is closed.

(self, message: bytes, max_doc_size: int)

Source from the content-addressed store, hash-verified

431 await self._raise_connection_failure(error)
432
433 async def send_message(self, message: bytes, max_doc_size: int) -> None:
434 """Send a raw BSON message or raise ConnectionFailure.
435
436 If a network exception is raised, the socket is closed.
437 """
438 if self.max_bson_size is not None and max_doc_size > self.max_bson_size:
439 raise DocumentTooLarge(
440 "BSON document too large (%d bytes) - the connected server "
441 "supports BSON document sizes up to %d bytes." % (max_doc_size, self.max_bson_size)
442 )
443
444 try:
445 await async_sendall(self.conn.get_conn, message)
446 # Catch KeyboardInterrupt, CancelledError, etc. and cleanup.
447 except BaseException as error:
448 await self._raise_connection_failure(error)
449
450 async def receive_message(self, request_id: Optional[int]) -> Union[_OpReply, _OpMsg]:
451 """Receive a raw BSON message or raise ConnectionFailure.

Callers 3

unack_writeMethod · 0.95
write_commandMethod · 0.95
run_operationMethod · 0.45

Calls 3

DocumentTooLargeClass · 0.90
async_sendallFunction · 0.90

Tested by

no test coverage detected