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

cancelRolesFromRole (데이터베이스 명령)

revokeRolesFromRole

역할에서 지정된 상속된 역할을 제거합니다.

In mongosh, this command can also be run through the db.revokeRolesFromRole() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

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

  • MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스

중요

이 명령은 M0 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.

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

db.runCommand(
{
revokeRolesFromRole: "<role>",
roles: [
{ role: "<role>", db: "<database>" } | "<role>",
...
],
writeConcern: { <write concern> },
comment: <any>
}
)

명령에는 다음과 같은 필드가 있습니다.

필드
유형
설명

revokeRolesFromRole

문자열

상속된 역할을 제거할 역할입니다.

roles

배열

제거할 상속된 역할입니다.

writeConcern

문서

선택 사항입니다. 작업에 대한 쓰기 고려 수준입니다. 쓰기 고려 사양을 참조하세요.

comment

any

선택 사항. 이 명령에 첨부할 사용자 제공 코멘트입니다. 설정되면 이 설명은 다음 위치에서 이 명령의 레코드와 함께 표시됩니다.

댓글은 유효한 모든 BSON types (문자열, 정수, 객체, 배열 등)이 될 수 있습니다.

roles 필드에서 기본 제공 역할사용자 정의 역할을 모두 지정할 수 있습니다.

To specify a role that exists in the same database where revokeRolesFromRole runs, you can either specify the role with the name of the role:

"readWrite"

또는 다음과 같이 문서로 역할을 지정할 수도 있습니다.

{ role: "<role>", db: "<database>" }

다른 데이터베이스에 존재하는 역할을 지정하려면 문서를 사용하여 역할을 지정합니다.

해당 데이터베이스에서 역할을 철회하려면 데이터베이스에 revokeRole 조치가 있어야 합니다.

emea 데이터베이스의 purchaseAgents 역할은 roles 배열에 나열된 대로 다른 여러 역할의 권한을 상속받습니다.

{
"_id" : "emea.purchaseAgents",
"role" : "purchaseAgents",
"db" : "emea",
"privileges" : [],
"roles" : [
{
"role" : "readOrdersCollection",
"db" : "emea"
},
{
"role" : "readAccountsCollection",
"db" : "emea"
},
{
"role" : "writeOrdersCollection",
"db" : "emea"
}
]
}

The following revokeRolesFromRole operation on the emea database removes two roles from the purchaseAgents role:

use emea
db.runCommand( { revokeRolesFromRole: "purchaseAgents",
roles: [
"writeOrdersCollection",
"readOrdersCollection"
],
writeConcern: { w: "majority" , wtimeout: 5000 }
} )

이제 purchaseAgents 역할에는 하나의 역할만 포함됩니다.

{
"_id" : "emea.purchaseAgents",
"role" : "purchaseAgents",
"db" : "emea",
"privileges" : [],
"roles" : [
{
"role" : "readAccountsCollection",
"db" : "emea"
}
]
}