Docs Menu

dropUser

dropUser

Removes the user from the database on which you run the command.

mongosh에서 이 명령을 db.dropUser() 헬퍼 메서드를 통해서도 실행할 수 있습니다.

헬퍼 메서드는 mongosh 사용자에게 편리하지만 데이터베이스 명령과 동일한 수준의 정보를 반환하지 못할 수 있습니다. 편의가 필요하지 않거나 추가 리턴 필드가 필요한 경우 데이터베이스 명령을 사용합니다.

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

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

중요

This command is not supported in M10+ clusters. For more information, see Unsupported Commands.

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

db.runCommand(
{
dropUser: "<user>",
writeConcern: { <write concern> },
comment: <any>
}
)

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

필드
유형
설명

dropUser

문자열

The name of the user to delete. You must issue the dropUser command while using the database where the user exists.

writeConcern

문서

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

comment

any

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

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

userAdminAnyDatabase 역할이 있는 사용자를 제거하기 전에 사용자 관리 권한이 있는 다른 사용자가 한 명 이상 있는지 확인하세요.

해당 데이터베이스에서 사용자를 제거하려면 데이터베이스에 dropUser 조치가 있어야 합니다.

The following sequence of operations in mongosh removes reportUser1 from the products database:

use products
db.runCommand( {
dropUser: "reportUser1",
writeConcern: { w: "majority", wtimeout: 5000 }
} )