AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

killAllSessionsByPattern (데이터베이스 명령)

killAllSessionsByPattern

The killAllSessionsByPattern command kills all sessions that match any of the specified patterns. [1]

명령은 다음과 같은 구문을 가집니다:

db.runCommand(
{
killAllSessionsByPattern: [ <pattern>, ... ]
}
)

이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

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

이 명령은 일치시킬 패턴을 지정하는 문서 배열을 사용합니다.

패턴
설명

{ lsid: { id : <UUID> } }

종료할 세션 ID의 UUID 부분을 지정합니다.

{ uid: <BinData> }

종료할 세션 소유자의 해시를 지정합니다.

{ users: [ { user: <user>, db: <dbname> }, ... ] }

Specifies the owners of the sessions to kill. Requires additional privileges. See Access Control.

{ roles: [ { role: <role>, db: <dbname> }, ... ] }

Specifies the roles assigned to the owners of the sessions to kill. Requires additional privileges. See Access Control.

Specify an empty array to kill all sessions. [1]

기존 세션을 보려면 $listSessions 작업 또는 $listLocalSessions 를 참조하세요.

[1](1, 2) The killAllSessionsByPattern operation ignores sessions that have transactions in prepared state. See Behavior for details.

세션을 종료하면 세션에서 진행 중인 모든 작업이 종료되고 이러한 작업과 관련된 열려 있는 커서가 모두 닫힙니다.

종료된 세션은 여전히 현재 세션으로 나열될 수 있으며, 향후 작업에서 종료된 세션을 사용할 수 있습니다. 기존 세션을 보려면 $listSessions 작업 또는 $listLocalSessions 를 참조하세요.

The killAllSessionsByPattern 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.

If the deployment enforces authentication/authorization, you must have the killAnySession privilege action to run the killAllSessionsByPattern command.

users 또는 roles 포함하는 패턴의 경우 cluster 리소스에 대한 impersonate 조치를 부여하는 권한도 있어야 합니다.

참고

사용자는 killAnySession 권한 조치가 없어도 자신의 세션을 종료할 수 있습니다.

다음 작업은 모든 세션을 종료합니다.

db.runCommand( { killAllSessionsByPattern: [ ] } )

다음 작업은 지정된 uid 를 가지고 있고 소유자에게 지정된 역할이 있는 모든 세션을 종료합니다.

db.runCommand( { killAllSessionsByPattern: [
{ "uid" : BinData(0,"oBRA45vMY78p1tv6kChjQPTdYsnCHi/kA/fFMZTIV1o=") },
{ roles: [ { role: "readWrite", db: "test" } ] }
] } )