ClientEncryption.encryptExpression(keyId, expression, encOptions)ClientEncryption.encryptExpression쿼리된 필드의keyId,encOptions문서의 쿼리 유형 및 알고리즘을 사용하여 범위 인덱스를 쿼리하기 위해 MQL 표현식을 암호화합니다. 쿼리의 암호화된 결과를 반환합니다.반환합니다: 쿼리 의 암호화됨 결과는 하위 6
binary data유형이 인 객체 입니다.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
clientEncryption = db.getMongo().getClientEncryption() clientEncryption.encryptExpression( keyId, expression, encOptions )
Parameter | 유형 | 설명 |
|---|---|---|
|
| 표현식 에서 쿼리된 필드 에 대한 데이터 암호화 키 . The UUID is a BSON |
| 문서 | |
| 문서 | 필드가 있는 문서 :
|
행동
The mongosh client-side field level and queryable encryption methods require a database connection configured for client-side encryption. If the current database connection was not initiated with client-side field level encryption enabled, either:
mongosh의Mongo()생성자를 사용하여 필요한 클라이언트 사이드 필드 수준 암호화 옵션과 연결을 설정합니다.Mongo()메서드는 고객 마스터 키(CMK) 관리를 위해 다음과 같은 키 관리 서비스(KMS) 공급자를 지원합니다.
or
- Use the
mongoshcommand line options to establish a connection with the required options. The command line options only support the Amazon Web Services KMS provider for CMK management.
예시
clientEncryption.encryptExpression( UUID("64e2d87d-f168-493c-bbdf-a394535a2cb9"), { $and: [{ val: { $gt: Int32('100') } }, { val: { $lt: Int32('150') } }] }, { algorithm: 'range', queryType: 'range', rangeOptions: { min: Int32('0'), max: Int32('200') }, contentionFactor: 8 })
성공적인 하면 ClientEncryption.encryptExpression 가 암호화됨 쿼리 결과를 반환합니다.
자세히 알아보기
클라이언트 측 필드 레벨 암호화 또는 Queryable Encryption 활성화된 상태에서 MongoDB 연결을 시작하는 방법에 대한 전체 문서는 Mongo()를 참조하세요.