diff --git a/src/mongocxx/lib/mongocxx/v1/client_encryption.cpp b/src/mongocxx/lib/mongocxx/v1/client_encryption.cpp index 81a3ac8cd6..968cf9f4eb 100644 --- a/src/mongocxx/lib/mongocxx/v1/client_encryption.cpp +++ b/src/mongocxx/lib/mongocxx/v1/client_encryption.cpp @@ -73,12 +73,6 @@ struct encrypt_opts_deleter { using encrypt_opts_ptr_type = std::unique_ptr; encrypt_opts_ptr_type to_mongoc(v1::encrypt_options const& opts) { - struct encrypt_opts_deleter { - void operator()(mongoc_client_encryption_encrypt_opts_t* ptr) noexcept { - libmongoc::client_encryption_encrypt_opts_destroy(ptr); - } - }; - auto ret = encrypt_opts_ptr_type{libmongoc::client_encryption_encrypt_opts_new()}; auto const ptr = ret.get(); diff --git a/src/mongocxx/lib/mongocxx/v1/indexes.cpp b/src/mongocxx/lib/mongocxx/v1/indexes.cpp index 50d0665c98..4d28917e04 100644 --- a/src/mongocxx/lib/mongocxx/v1/indexes.cpp +++ b/src/mongocxx/lib/mongocxx/v1/indexes.cpp @@ -246,6 +246,8 @@ bsoncxx::v1::stdx::optional create_one_impl( // SERVER-78611: sharded clusters may place fields in a raw response document instead of in // the top-level document. if (auto const raw = reply_owner.view()["raw"]) { + auto const shard_response = raw.get_document().view(); + // There should only be a single field in the raw response with the shard connection // string as the key. e.g.: // { @@ -256,8 +258,8 @@ bsoncxx::v1::stdx::optional create_one_impl( // } // } // Using a for loop for convenience. - for (auto const& shard_response : raw.get_document().view()) { - return shard_response.get_document().view(); + for (auto const e : shard_response) { + return e.get_document().view(); } } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/client_encryption.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/client_encryption.cpp index dae0ca828a..7cc2af4e1d 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/client_encryption.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/client_encryption.cpp @@ -81,12 +81,6 @@ struct encrypt_opts_deleter { using encrypt_opts_ptr_type = std::unique_ptr; encrypt_opts_ptr_type to_mongoc(v_noabi::options::encrypt const& opts) { - struct encrypt_opts_deleter { - void operator()(mongoc_client_encryption_encrypt_opts_t* ptr) noexcept { - libmongoc::client_encryption_encrypt_opts_destroy(ptr); - } - }; - auto ret = encrypt_opts_ptr_type{libmongoc::client_encryption_encrypt_opts_new()}; auto const ptr = ret.get(); diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/index_view.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/index_view.cpp index bc65d7b73f..d3d1678961 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/index_view.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/index_view.cpp @@ -136,6 +136,8 @@ bsoncxx::v1::stdx::optional create_one_impl( // SERVER-78611: sharded clusters may place fields in a raw response document instead of in // the top-level document. if (auto const raw = reply_owner.view()["raw"]) { + auto const shard_response = raw.get_document().view(); + // There should only be a single field in the raw response with the shard connection // string as the key. e.g.: // { @@ -146,8 +148,8 @@ bsoncxx::v1::stdx::optional create_one_impl( // } // } // Using a for loop for convenience. - for (auto const& shard_response : raw.get_document().view()) { - return shard_response.get_document().view(); + for (auto const e : shard_response) { + return e.get_document().view(); } }