Validate this session before use with client. Raises error if the client is not the one that created the session.
(
self, client: Optional[MongoClient[Any]], session: Optional[ClientSession]
)
| 530 | ) |
| 531 | |
| 532 | def validate_session( |
| 533 | self, client: Optional[MongoClient[Any]], session: Optional[ClientSession] |
| 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("Can only use session with the MongoClient that started it") |
| 542 | |
| 543 | def close_conn(self, reason: Optional[str]) -> None: |
| 544 | """Close this connection with a reason.""" |
no test coverage detected