Skip to content

Commit 2bfee92

Browse files
committed
replace rangePreview with range
1 parent 2718417 commit 2bfee92

File tree

4 files changed

+27
-33
lines changed

4 files changed

+27
-33
lines changed

src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class client_encryption {
132132
///
133133
/// Encrypts a Match Expression or Aggregate Expression to query a range index.
134134
///
135-
/// @note Only supported when queryType is "rangePreview" and algorithm is "RangePreview".
135+
/// @note Only supported when queryType is "range" and algorithm is "Range".
136136
///
137137
/// @param expr A BSON document corresponding to either a Match Expression or an Aggregate
138138
/// Expression.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ class encrypt {
110110
///
111111
/// Use range encryption.
112112
///
113-
/// @warning The Range algorithm is experimental only. It is not intended for public use. It
114-
/// is subject to breaking changes.
115-
///
116-
k_range_preview,
113+
k_range,
117114
};
118115

119116
///
@@ -127,7 +124,7 @@ class encrypt {
127124
/// @brief Use query type "rangePreview".
128125
/// @warning The Range algorithm is experimental only. It is not intended for public use. It
129126
/// is subject to breaking changes.
130-
k_range_preview,
127+
k_range,
131128
};
132129

133130
///
@@ -160,7 +157,7 @@ class encrypt {
160157

161158
///
162159
/// Sets the contention factor to use for encryption.
163-
/// contentionFactor only applies when algorithm is "Indexed" or "RangePreview".
160+
/// contentionFactor only applies when algorithm is "Indexed" or "Range".
164161
/// It is an error to set contentionFactor when algorithm is not "Indexed".
165162
///
166163
/// @param contention_factor
@@ -181,8 +178,8 @@ class encrypt {
181178
///
182179
/// @param query_type
183180
/// One of the following: - equality
184-
/// query_type only applies when algorithm is "Indexed" or "RangePreview".
185-
/// It is an error to set query_type when algorithm is not "Indexed" or "RangePreview".
181+
/// query_type only applies when algorithm is "Indexed" or "Range".
182+
/// It is an error to set query_type when algorithm is not "Indexed" or "Range".
186183
///
187184
encrypt& query_type(encryption_query_type query_type);
188185

src/mongocxx/lib/mongocxx/v_noabi/mongocxx/options/encrypt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ void* encrypt::convert() const {
183183
libmongoc::client_encryption_encrypt_opts_set_algorithm(
184184
opts, MONGOC_ENCRYPT_ALGORITHM_UNINDEXED);
185185
break;
186-
case encryption_algorithm::k_range_preview:
186+
case encryption_algorithm::k_range:
187187
libmongoc::client_encryption_encrypt_opts_set_algorithm(
188-
opts, MONGOC_ENCRYPT_ALGORITHM_RANGEPREVIEW);
188+
opts, MONGOC_ENCRYPT_ALGORITHM_RANGE);
189189
break;
190190
default:
191191
throw exception{error_code::k_invalid_parameter,
@@ -206,9 +206,9 @@ void* encrypt::convert() const {
206206
libmongoc::client_encryption_encrypt_opts_set_query_type(
207207
opts, MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY);
208208
break;
209-
case encryption_query_type::k_range_preview:
209+
case encryption_query_type::k_range:
210210
libmongoc::client_encryption_encrypt_opts_set_query_type(
211-
opts, MONGOC_ENCRYPT_QUERY_TYPE_RANGEPREVIEW);
211+
opts, MONGOC_ENCRYPT_QUERY_TYPE_RANGE);
212212
break;
213213
default:
214214
throw exception{error_code::k_invalid_parameter, "unsupported query type"};

src/mongocxx/test/client_side_encryption.cpp

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,12 +3102,11 @@ range_explicit_encryption_objects range_explicit_encryption_setup(const std::str
31023102
// algorithm: "RangePreview",
31033103
// contentionFactor: 0
31043104
// }
3105-
const auto encrypt_opts =
3106-
options::encrypt()
3107-
.range_opts(range_opts)
3108-
.key_id(key1_id)
3109-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3110-
.contention_factor(0);
3105+
const auto encrypt_opts = options::encrypt()
3106+
.range_opts(range_opts)
3107+
.key_id(key1_id)
3108+
.algorithm(options::encrypt::encryption_algorithm::k_range)
3109+
.contention_factor(0);
31113110

31123111
// Use `clientEncryption` to encrypt these values: 0, 6, 30, and 200.
31133112
const auto encrypted_v0 = client_encryption.encrypt(field_values.v0, encrypt_opts);
@@ -3216,7 +3215,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
32163215
options::encrypt()
32173216
.range_opts(range_opts)
32183217
.key_id(key1_id)
3219-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3218+
.algorithm(options::encrypt::encryption_algorithm::k_range)
32203219
.contention_factor(0));
32213220

32223221
// Use `clientEncryption` to decrypt `insertPayload`.
@@ -3251,8 +3250,8 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
32513250
options::encrypt()
32523251
.range_opts(range_opts)
32533252
.key_id(key1_id)
3254-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3255-
.query_type(options::encrypt::encryption_query_type::k_range_preview)
3253+
.algorithm(options::encrypt::encryption_algorithm::k_range)
3254+
.query_type(options::encrypt::encryption_query_type::k_range)
32563255
.contention_factor(0));
32573256

32583257
// Use encryptedClient to run a "find" operation on the `db.explicit_encryption`
@@ -3303,8 +3302,8 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
33033302
options::encrypt()
33043303
.range_opts(range_opts)
33053304
.key_id(key1_id)
3306-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3307-
.query_type(options::encrypt::encryption_query_type::k_range_preview)
3305+
.algorithm(options::encrypt::encryption_algorithm::k_range)
3306+
.query_type(options::encrypt::encryption_query_type::k_range)
33083307
.contention_factor(0));
33093308

33103309
// Use `encryptedClient` to run a "find" operation on the `db.explicit_encryption`
@@ -3351,8 +3350,8 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
33513350
options::encrypt()
33523351
.range_opts(range_opts)
33533352
.key_id(key1_id)
3354-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3355-
.query_type(options::encrypt::encryption_query_type::k_range_preview)
3353+
.algorithm(options::encrypt::encryption_algorithm::k_range)
3354+
.query_type(options::encrypt::encryption_query_type::k_range)
33563355
.contention_factor(0));
33573356

33583357
// Use encryptedClient to run a "find" operation on the `db.explicit_encryption`
@@ -3397,8 +3396,8 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
33973396
options::encrypt()
33983397
.range_opts(range_opts)
33993398
.key_id(key1_id)
3400-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3401-
.query_type(options::encrypt::encryption_query_type::k_range_preview)
3399+
.algorithm(options::encrypt::encryption_algorithm::k_range)
3400+
.query_type(options::encrypt::encryption_query_type::k_range)
34023401
.contention_factor(0));
34033402

34043403
// Use encryptedClient to run a "find" operation on the `db.explicit_encryption`
@@ -3448,8 +3447,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
34483447
options::encrypt()
34493448
.range_opts(range_opts)
34503449
.key_id(key1_id)
3451-
.algorithm(
3452-
options::encrypt::encryption_algorithm::k_range_preview)
3450+
.algorithm(options::encrypt::encryption_algorithm::k_range)
34533451
.contention_factor(0)),
34543452
Catch::Contains(
34553453
"Value must be greater than or equal to the minimum value and "
@@ -3477,7 +3475,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
34773475
options::encrypt()
34783476
.range_opts(range_opts)
34793477
.key_id(key1_id)
3480-
.algorithm(options::encrypt::encryption_algorithm::k_range_preview)
3478+
.algorithm(options::encrypt::encryption_algorithm::k_range)
34813479
.contention_factor(0);
34823480

34833481
// If the encrypted field is encryptedInt encrypt:
@@ -3533,8 +3531,7 @@ TEST_CASE("Range Explicit Encryption", "[client_side_encryption]") {
35333531
.sparsity(1)
35343532
.precision(2))
35353533
.key_id(key1_id)
3536-
.algorithm(
3537-
options::encrypt::encryption_algorithm::k_range_preview)
3534+
.algorithm(options::encrypt::encryption_algorithm::k_range)
35383535
.contention_factor(0)),
35393536
Catch::Contains(
35403537
"expected 'precision' to be set with double or decimal128 index"));

0 commit comments

Comments
 (0)