ClientEncryption.encryptExpression(keyId, expression, encOptions)ClientEncryption.encryptExpressionMQL 式 を暗号化して範囲インデックスをクエリするには、クエリされたフィールドのkeyIdおよびencOptionsドキュメントからのクエリの種類とアルゴリズムを使用します。クエリの暗号化された結果を返します。次の値を返します。 サブタイプ を持つ
binary data6オブジェクトとしてのクエリの暗号化された結果。
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- 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(Customer Master Key)管理用に次のKMS ( 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() をご覧ください。