Skip to content

Commit 9aa7661

Browse files
authored
CXX-3236 add mongocxx v1 declarations (#1482)
1 parent d29bad7 commit 9aa7661

File tree

77 files changed

+12048
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+12048
-144
lines changed

src/mongocxx/include/mongocxx/v1/aggregate_options.hpp

Lines changed: 187 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,204 @@
2020

2121
#include <mongocxx/v1/detail/prelude.hpp>
2222

23+
#include <bsoncxx/v1/document/value-fwd.hpp>
24+
#include <bsoncxx/v1/document/view-fwd.hpp>
25+
#include <bsoncxx/v1/types/value-fwd.hpp>
26+
#include <bsoncxx/v1/types/view-fwd.hpp>
27+
28+
#include <mongocxx/v1/hint-fwd.hpp>
29+
#include <mongocxx/v1/read_concern-fwd.hpp>
30+
#include <mongocxx/v1/read_preference-fwd.hpp>
31+
#include <mongocxx/v1/write_concern-fwd.hpp>
32+
33+
#include <bsoncxx/v1/stdx/optional.hpp>
34+
35+
#include <mongocxx/v1/config/export.hpp>
36+
37+
#include <chrono>
38+
#include <cstdint>
39+
2340
namespace mongocxx {
2441
namespace v1 {
2542

2643
///
2744
/// Options for an "aggregate" command.
2845
///
46+
/// Supported fields include:
47+
/// - `allow_disk_use` ("allowDiskUse")
48+
/// - `batch_size` ("batchSize")
49+
/// - `bypass_document_validation` ("bypassDocumentValidation")
50+
/// - `collation`
51+
/// - `comment`
52+
/// - `hint`
53+
/// - `let`
54+
/// - `max_time` ("maxTimeMS")
55+
/// - `read_concern` ("readConcern")
56+
/// - `read_preference` ("readPreference")
57+
/// - `write_concern` ("writeConcern")
58+
///
2959
/// @see
3060
/// - [`aggregate` (database command) (MongoDB Manual)](https://www.mongodb.com/docs/manual/aggregation/)
3161
///
3262
/// @attention This feature is experimental! It is not ready for use!
3363
///
34-
class aggregate_options {};
64+
class aggregate_options {
65+
private:
66+
class impl;
67+
void* _impl;
68+
69+
public:
70+
///
71+
/// Destroy this object.
72+
///
73+
/// @warning Invalidates all associated views.
74+
///
75+
MONGOCXX_ABI_EXPORT_CDECL() ~aggregate_options();
76+
77+
///
78+
/// Move constructor.
79+
///
80+
/// @par Postconditions:
81+
/// - `other` is in an assign-or-destroy-only state.
82+
///
83+
MONGOCXX_ABI_EXPORT_CDECL() aggregate_options(aggregate_options&& other) noexcept;
84+
85+
///
86+
/// Move assignment.
87+
///
88+
/// @par Postconditions:
89+
/// - `other` is in an assign-or-destroy-only state.
90+
///
91+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) operator=(aggregate_options&& other) noexcept;
92+
93+
///
94+
/// Copy construction.
95+
///
96+
MONGOCXX_ABI_EXPORT_CDECL() aggregate_options(aggregate_options const& other);
97+
98+
///
99+
/// Copy assignment.
100+
///
101+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) operator=(aggregate_options const& other);
102+
103+
///
104+
/// Default initialization.
105+
///
106+
/// @par Postconditions:
107+
/// - All supported fields are "unset" or zero-initialized.
108+
///
109+
MONGOCXX_ABI_EXPORT_CDECL() aggregate_options();
110+
111+
///
112+
/// Set the "allowDiskUse" field.
113+
///
114+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) allow_disk_use(bool allow_disk_use);
115+
116+
///
117+
/// Return the current "allowDiskUse" field.
118+
///
119+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) allow_disk_use() const;
120+
121+
///
122+
/// Set the "batchSize" field.
123+
///
124+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) batch_size(std::int32_t batch_size);
125+
126+
///
127+
/// Return the current "batchSize" field.
128+
///
129+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::int32_t>) batch_size() const;
130+
131+
///
132+
/// Set the "collation" field.
133+
///
134+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) collation(bsoncxx::v1::document::value collation);
135+
136+
///
137+
/// Return the current "collation" field.
138+
///
139+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) collation() const;
140+
141+
///
142+
/// Set the "let" field.
143+
///
144+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) let(bsoncxx::v1::document::value let);
145+
146+
///
147+
/// Return the current "let" field.
148+
///
149+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) let() const;
150+
151+
///
152+
/// Set the "maxTimeMS" field.
153+
///
154+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) max_time(std::chrono::milliseconds max_time);
155+
156+
///
157+
/// Return the current "maxTimeMS" field.
158+
///
159+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<std::chrono::milliseconds>) max_time() const;
160+
161+
///
162+
/// Set the "readPreference" field.
163+
///
164+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) read_preference(v1::read_preference rp);
165+
166+
///
167+
/// Return the current "readPreference" field.
168+
///
169+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<v1::read_preference>) read_preference() const;
170+
171+
///
172+
/// Set the "bypassDocumentValidation" field.
173+
///
174+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) bypass_document_validation(bool bypass_document_validation);
175+
176+
///
177+
/// Return the current "bypassDocumentValidation" field.
178+
///
179+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) bypass_document_validation() const;
180+
181+
///
182+
/// Set the "hint" field.
183+
///
184+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) hint(v1::hint index_hint);
185+
186+
///
187+
/// Return the current "hint" field.
188+
///
189+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<v1::hint>) hint() const;
190+
191+
///
192+
/// Set the "writeConcern" field.
193+
///
194+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) write_concern(v1::write_concern write_concern);
195+
196+
///
197+
/// Return the current "writeConcern" field.
198+
///
199+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<v1::write_concern>) write_concern() const;
200+
201+
///
202+
/// Set the "readConcern" field.
203+
///
204+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) read_concern(v1::read_concern read_concern);
205+
206+
///
207+
/// Return the current "readConcern" field.
208+
///
209+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<v1::read_concern>) read_concern() const;
210+
211+
///
212+
/// Set the "comment" field.
213+
///
214+
MONGOCXX_ABI_EXPORT_CDECL(aggregate_options&) comment(bsoncxx::v1::types::value comment);
215+
216+
///
217+
/// Return the current "comment" field.
218+
///
219+
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::view>) comment() const;
220+
};
35221

36222
} // namespace v1
37223
} // namespace mongocxx

0 commit comments

Comments
 (0)