정의
killSessionsThe
killSessionscommand kills the specified sessions. If access control is enabled, the command only kills the sessions owned by the user. [1]
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { killSessions: [ { id : <UUID> }, ... ] } )
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
중요
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
명령 필드
The command takes an array of documents that specify the UUID portion of the session id. Specify an empty array [ ] to kill all sessions, or if access control is enabled, all sessions owned by the user. [1]
기존 세션 보기
기존 세션을 보려면 $listSessions 작업 또는 $listLocalSessions 를 참조하세요.
| [1] | (1, 2) The killSessions operation ignores sessions that have transactions in prepared state. See Behavior for details. |
행동
세션 식별
MongoDB concatenates each of the specified UUIDs with the hash of the authenticated user credentials to identify the user's sessions to kill. If the user has no session that match, the killSessions has no effect.
진행 중인 작업
세션을 종료하면 세션에서 진행 중인 모든 작업이 종료되고 이러한 작업과 관련된 열려 있는 커서가 모두 닫힙니다.
종료된 세션 가용성
종료된 세션은 여전히 현재 세션으로 나열될 수 있으며, 향후 작업에서 종료된 세션을 사용할 수 있습니다. 기존 세션을 보려면 $listSessions 작업 또는 $listLocalSessions 를 참조하세요.
준비된 상태의 트랜잭션이 있는 세션
The killSessions operation ignores sessions that have Transactions in prepared state. Transactions in prepared state refer to transactions with write operations that span multiple shards whose commit coordinator has completed the "sendingPrepare" action.
예시
다음 작업은 사용자에 대해 지정된 세션을 종료합니다.
db.runCommand( { killSessions: [ { id: UUID("f9b3d8d9-9496-4fff-868f-04a6196fc58a") } ] } )