insert_one.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2014 MongoDB Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <bsoncxx/document/view_or_value.hpp>
  16. #include <mongocxx/config/prelude.hpp>
  17. namespace mongocxx {
  18. MONGOCXX_INLINE_NAMESPACE_BEGIN
  19. namespace model {
  20. ///
  21. /// Class representing a MongoDB insert operation that creates a single document.
  22. ///
  23. class MONGOCXX_API insert_one {
  24. public:
  25. ///
  26. /// Constructs an insert operation that will create a single document.
  27. ///
  28. /// @param document
  29. /// The document to insert.
  30. ///
  31. insert_one(bsoncxx::document::view_or_value document);
  32. ///
  33. /// Gets the document to be inserted.
  34. ///
  35. /// @return The document to be inserted.
  36. ///
  37. const bsoncxx::document::view_or_value& document() const;
  38. private:
  39. bsoncxx::document::view_or_value _document;
  40. };
  41. } // namespace model
  42. MONGOCXX_INLINE_NAMESPACE_END
  43. } // namespace mongocxx
  44. #include <mongocxx/config/postlude.hpp>