Validate this session before use with client. Raises error if the client is not the one that created the session.
(
self, client: Optional[AsyncMongoClient[Any]], session: Optional[AsyncClientSession]
)
| 530 | ) |
| 531 | |
| 532 | def validate_session( |
| 533 | self, client: Optional[AsyncMongoClient[Any]], session: Optional[AsyncClientSession] |
| 534 | ) -> None: |
| 535 | """Validate this session before use with client. |
| 536 | |
| 537 | Raises error if the client is not the one that created the session. |
| 538 | """ |
| 539 | if session: |
| 540 | if session._client is not client: |
| 541 | raise InvalidOperation( |
| 542 | "Can only use session with the AsyncMongoClient that started it" |
| 543 | ) |
| 544 | |
| 545 | async def close_conn(self, reason: Optional[str]) -> None: |
| 546 | """Close this connection with a reason.""" |
no test coverage detected