Skip to content

Commit 526ca26

Browse files
committed
Merge branch 'CXX-2496' of github.com:kkloberdanz/mongo-cxx-driver into CXX-2496
2 parents c31e334 + 5b98ec2 commit 526ca26

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/mongocxx/test/spec/operation.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,15 +1282,16 @@ document::value operation_runner::_run_create_collection(document::view operatio
12821282
auto arguments = operation["arguments"].get_document().value;
12831283
auto collection_name = arguments["collection"].get_string().value;
12841284
auto session = _lookup_session(arguments);
1285+
bsoncxx::builder::basic::document opts;
1286+
1287+
if (arguments["encryptedFields"]) {
1288+
opts.append(kvp("encryptedFields", arguments["encryptedFields"].get_document().value));
1289+
}
12851290

12861291
if (session) {
1287-
_db->create_collection(*session, collection_name);
1288-
} else if (arguments.find("encryptedFields") != arguments.end()) {
1289-
auto encrypted_fields = arguments["encryptedFields"].get_document().value;
1290-
auto encrypted_fields_map = make_document(kvp("encryptedFields", encrypted_fields));
1291-
_db->create_collection(collection_name, std::move(encrypted_fields_map));
1292+
_db->create_collection(*session, collection_name, opts.extract());
12921293
} else {
1293-
_db->create_collection(collection_name);
1294+
_db->create_collection(collection_name, opts.extract());
12941295
}
12951296
return empty_document;
12961297
}

0 commit comments

Comments
 (0)