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

Method validate_session

pymongo/asynchronous/pool.py:532–543  ·  view source on GitHub ↗

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]
    )

Source from the content-addressed store, hash-verified

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."""

Callers 3

commandMethod · 0.95
_execute_commandMethod · 0.45
_execute_commandMethod · 0.45

Calls 1

InvalidOperationClass · 0.90

Tested by

no test coverage detected