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

KeyVault.deleteKey() (mongosh 메서드)

KeyVault.deleteKey(UUID)

지정된 UUID를 가진 데이터 암호화 키를 데이터베이스 연결에 연결된 키 모음에서 삭제합니다.

deleteKey() 의 구문은 다음과 같습니다:

keyVault = db.getMongo().getKeyVault()
keyVault.deleteKey(UUID("<UUID String>"))

The UUID is a BSON binary data object with subtype 4.

반환합니다:

삭제된 키의 개수를 나타내는 문서입니다.

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

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

The mongosh client-side field level encryption methods require a database connection with client-side field level encryption enabled. If the current database connection was not initiated with client-side field level encryption enabled, either:

The following example is intended for rapid evaluation of client-side field level encryption. For specific examples of using KeyVault.deleteKey() with each supported KMS provider, see Delete a Data Encryption Key.

1

mongosh 클라이언트를 시작합니다.

mongosh --nodb
2

로컬로 managed 키에 대한 클라이언트 사이드 필드 수준 암호화를 구성하려면 줄바꿈 없이 base64로 인코딩된 96바이트 문자열을 생성합니다.

const TEST_LOCAL_KEY = require("crypto").randomBytes(96).toString("base64")
3

생성된 로컬 키 문자열을 사용하여 클라이언트 사이드 필드 수준 암호화 옵션을 생성합니다.

let autoEncryptionOpts = {
"keyVaultNamespace" : "encryption.__dataKeys",
"kmsProviders" : {
"local" : {
"key" : BinData(0, TEST_LOCAL_KEY)
}
}
}
4

Mongo() 생성자를 클라이언트 사이드 필드 수준 암호화 옵션과 함께 사용하여 데이터베이스 연결을 생성합니다. mongodb://myMongo.example.net URI를 대상 cluster의 연결 문자열 URI 로 바꿉니다.

encryptedClient = Mongo(
"mongodb://myMongo.example.net:27017/?replSetName=myMongo",
autoEncryptionOpts
)

Retrieve the KeyVault object and use the KeyVault.deleteKey() method to delete the data encryption key with matching UUID:

keyVault = encryptedClient.getKeyVault()
keyVault.deleteKey(UUID("b4b41b33-5c97-412e-a02b-743498346079"))

If successful, deleteKey() returns output similar to the following:

{ "acknowledged" : true, "deletedCount" : 1 }
이 페이지 평가하기

이 페이지의 내용