// Copyright 2009-present MongoDB, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include // IWYU pragma: export // #include #include #include #include #include #include namespace mongocxx { namespace v1 { /// /// The result of a "replaceOne" operation. /// /// Supported fields include: /// - `result` /// /// @see /// - [Update Methods (MongoDB Manual)](https://www.mongodb.com/docs/manual/reference/update-methods/) /// class replace_one_result { private: class impl; void* _impl; public: /// /// Destroy this object. /// /// @warning Invalidates all associated views. /// MONGOCXX_ABI_EXPORT_CDECL() ~replace_one_result(); /// /// Move constructor. /// /// @par Postconditions: /// - `other` is in an assign-or-destroy-only state. /// MONGOCXX_ABI_EXPORT_CDECL() replace_one_result(replace_one_result&& other) noexcept; /// /// Move assignment. /// /// @par Postconditions: /// - `other` is in an assign-or-destroy-only state. /// MONGOCXX_ABI_EXPORT_CDECL(replace_one_result&) operator=(replace_one_result&& other) noexcept; /// /// Copy construction. /// MONGOCXX_ABI_EXPORT_CDECL() replace_one_result(replace_one_result const& other); /// /// Copy assignment. /// MONGOCXX_ABI_EXPORT_CDECL(replace_one_result&) operator=(replace_one_result const& other); /// /// Return the raw bulk write result. /// MONGOCXX_ABI_EXPORT_CDECL(v1::bulk_write::result) result() const; /// /// Return the number of documents that matched the filter. /// MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) matched_count() const; /// /// Return the number of documents that were modified. /// MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) modified_count() const; /// /// Return the upserted document ID. /// /// @returns Empty when no document was upserted. /// MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional) upserted_id() const; /// /// Compare equal when all supported fields compare equal. /// /// @{ friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(replace_one_result const& lhs, replace_one_result const& rhs); friend bool operator!=(replace_one_result const& lhs, replace_one_result const& rhs) { return !(lhs == rhs); } /// @} /// class internal; private: /* explicit(false) */ replace_one_result(void* impl); }; } // namespace v1 } // namespace mongocxx #include /// /// @file /// Provides @ref mongocxx::v1::replace_one_result. ///