delete.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 <bsoncxx/stdx/optional.hpp>
  17. #include <mongocxx/hint.hpp>
  18. #include <mongocxx/write_concern.hpp>
  19. #include <mongocxx/config/prelude.hpp>
  20. namespace mongocxx {
  21. MONGOCXX_INLINE_NAMESPACE_BEGIN
  22. namespace options {
  23. ///
  24. /// Class representing the optional arguments to a MongoDB delete operation
  25. ///
  26. class MONGOCXX_API delete_options {
  27. public:
  28. ///
  29. /// Sets the collation for this operation.
  30. ///
  31. /// @param collation
  32. /// The new collation.
  33. ///
  34. /// @return
  35. /// A reference to the object on which this member function is being called. This facilitates
  36. /// method chaining.
  37. ///
  38. /// @see
  39. /// https://docs.mongodb.com/master/reference/collation/
  40. ///
  41. delete_options& collation(bsoncxx::document::view_or_value collation);
  42. ///
  43. /// Retrieves the current collation for this operation.
  44. ///
  45. /// @return
  46. /// The current collation.
  47. ///
  48. /// @see
  49. /// https://docs.mongodb.com/master/reference/collation/
  50. ///
  51. const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
  52. ///
  53. /// Sets the write_concern for this operation.
  54. ///
  55. /// @param wc
  56. /// The new write_concern.
  57. ///
  58. /// @return
  59. /// A reference to the object on which this member function is being called. This facilitates
  60. /// method chaining.
  61. ///
  62. /// @see https://docs.mongodb.com/master/core/write-concern/
  63. ///
  64. delete_options& write_concern(write_concern wc);
  65. ///
  66. /// The current write_concern for this operation.
  67. ///
  68. /// @return
  69. /// The current write_concern.
  70. ///
  71. /// @see https://docs.mongodb.com/master/core/write-concern/
  72. ///
  73. ///
  74. const stdx::optional<class write_concern>& write_concern() const;
  75. ///
  76. /// Sets the index to use for this operation.
  77. ///
  78. /// @note if the server already has a cached shape for this query, it may
  79. /// ignore a hint.
  80. ///
  81. /// @param index_hint
  82. /// Object representing the index to use.
  83. ///
  84. /// @return
  85. /// A reference to the object on which this member function is being called. This facilitates
  86. /// method chaining.
  87. ///
  88. delete_options& hint(class hint index_hint);
  89. ///
  90. /// Gets the current hint.
  91. ///
  92. /// @return The current hint, if one is set.
  93. ///
  94. const stdx::optional<class hint>& hint() const;
  95. private:
  96. stdx::optional<bsoncxx::document::view_or_value> _collation;
  97. stdx::optional<class write_concern> _write_concern;
  98. stdx::optional<class hint> _hint;
  99. };
  100. } // namespace options
  101. MONGOCXX_INLINE_NAMESPACE_END
  102. } // namespace mongocxx
  103. #include <mongocxx/config/postlude.hpp>