dropRole
정의
dropRole
Deletes a user-defined role from the database on which you run the command.
팁
mongosh
에서 이 명령을db.dropRole()
헬퍼 메서드를 통해서도 실행할 수 있습니다.헬퍼 메서드는
mongosh
사용자에게 편리하지만 데이터베이스 명령과 동일한 수준의 정보를 반환하지 못할 수 있습니다. 편의가 필요하지 않거나 추가 리턴 필드가 필요한 경우 데이터베이스 명령을 사용합니다.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스
중요
이 명령은 M0, M2, M5, M10+ 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { dropRole: "<role>", writeConcern: { <write concern> }, comment: <any> } )
명령 필드
명령에는 다음과 같은 필드가 있습니다.
필드 | 유형 | 설명 |
---|---|---|
| 문자열 | The name of the user-defined role to remove from the database. |
| 문서 | |
| any | 선택 사항. 이 명령에 첨부할 사용자 제공 코멘트입니다. 설정되면 이 설명은 다음 위치에서 이 명령의 레코드와 함께 표시됩니다.
댓글은 유효한 모든 BSON types (문자열, 정수, 객체, 배열 등)이 될 수 있습니다. |
행동
인증
When a role is dropped on a mongod
, previously authenticated users
remain logged in to the database but immediately lose the role's privileges.
When a role is dropped on a mongos
, previously authenticated users
remain logged in to the database but lose the role's privileges when the cache
refreshes. The cache refreshes automatically after the time specified with the
userCacheInvalidationIntervalSecs
parameter or manually when
you run the invalidateUserCache
command.
필요한 액세스 권한
You must have the dropRole
조치 on a database to drop a role from that database.
예시
The following operations remove the readPrices
role from the
products
database:
use products db.runCommand( { dropRole: "readPrices", writeConcern: { w: "majority" } } )