정의
db.revokeRolesFromRole(rolename, roles, writeConcern)역할에서 지정된 상속된 역할을 제거합니다.
중요
Mongo쉬 방법
This page documents a
mongoshmethod. This is not the documentation for database commands or language-specific drivers, such as Node.js.데이터베이스 명령에 대해서는
revokeRolesFromRole명령을 참조하십시오.MongoDB API 드라이버의 경우 언어별 MongoDB 드라이버 설명서를 참조하세요.
The
db.revokeRolesFromRole()method uses the following syntax:db.revokeRolesFromRole( "<rolename>", [ <roles> ], { <writeConcern> } ) The
db.revokeRolesFromRole()method takes the following arguments:Parameter유형설명rolename문자열
역할을 해지할 역할의 이름입니다.
roles배열
제거할 상속된 역할입니다.
writeConcern문서
roles필드에서 기본 제공 역할과 사용자 정의 역할을 모두 지정할 수 있습니다.To specify a role that exists in the same database where
db.revokeRolesFromRole()runs, you can either specify the role with the name of the role:"readWrite" 또는 다음과 같이 문서로 역할을 지정할 수도 있습니다.
{ role: "<role>", db: "<database>" } 다른 데이터베이스에 존재하는 역할을 지정하려면 문서를 사용하여 역할을 지정합니다.
호환성
이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
중요
이 명령은 MongoDB Atlas 클러스터에서 지원되지 않습니다. 모든 명령에 대한 Atlas 지원에 관해 자세히 알아보려면 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
행동
복제본 세트
If run on a replica set, db.revokeRolesFromRole() is executed using "majority" write concern by default.
필요한 액세스 권한
해당 데이터베이스에서 역할을 철회하려면 데이터베이스에 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 db.revokeRolesFromRole() operation on the emea database removes two roles from the purchaseAgents role:
use emea db.revokeRolesFromRole( "purchaseAgents", [ "writeOrdersCollection", "readOrdersCollection" ], { w: "majority" , wtimeout: 5000 } )
이제 purchaseAgents 역할에는 하나의 역할만 포함됩니다.
{ "_id" : "emea.purchaseAgents", "role" : "purchaseAgents", "db" : "emea", "privileges" : [], "roles" : [ { "role" : "readAccountsCollection", "db" : "emea" } ] }