정의
dropAllRolesFromDatabase명령을 실행하는 데이터베이스에서 모든 사용자 정의 역할을 삭제합니다.
경고
The
dropAllRolesFromDatabaseremoves all user-defined roles from the database.팁
In
mongosh, this command can also be run through thedb.dropAllRoles()helper method.Helper methods are convenient for
mongoshusers, 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: 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의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { dropAllRolesFromDatabase: 1, writeConcern: { <write concern> }, comment: <any> } )
명령 필드
명령에는 다음과 같은 필드가 있습니다.
필드 | 유형 | 설명 |
|---|---|---|
| integer | 명령이 실행되는 데이터베이스에서 모든 사용자 정의 역할을 삭제하려면 |
| 문서 | /includes/source/fact-쓰기 고려 (write concern)-spec-link.rst |
| any | 선택 사항. 이 명령에 첨부할 사용자 제공 코멘트입니다. 설정되면 이 설명은 다음 위치에서 이 명령의 레코드와 함께 표시됩니다.
댓글은 유효한 모든 BSON types (문자열, 정수, 객체, 배열 등)이 될 수 있습니다. |
필요한 액세스 권한
예시
다음 작업은 products 데이터베이스에서 모든 사용자 정의 역할을 삭제합니다.
use products db.runCommand( { dropAllRolesFromDatabase: 1, writeConcern: { w: "majority" } } )
결과 문서의 n 필드는 삭제된 역할의 수를 보고합니다.
{ "n" : 4, "ok" : 1 }