Skip to content

Commit b3d9938

Browse files
committed
CXX-1053 Alphabetize options::create_collection members/methods
1 parent 52172cb commit b3d9938

File tree

2 files changed

+99
-99
lines changed

2 files changed

+99
-99
lines changed

src/mongocxx/options/create_collection.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ namespace mongocxx {
2424
MONGOCXX_INLINE_NAMESPACE_BEGIN
2525
namespace options {
2626

27-
create_collection& create_collection::capped(bool capped) {
28-
_capped = capped;
27+
create_collection& create_collection::auto_index_id(bool auto_index_id) {
28+
_auto_index_id = auto_index_id;
2929
return *this;
3030
}
3131

32-
create_collection& create_collection::auto_index_id(bool auto_index_id) {
33-
_auto_index_id = auto_index_id;
32+
create_collection& create_collection::capped(bool capped) {
33+
_capped = capped;
3434
return *this;
3535
}
3636

37-
create_collection& create_collection::size(int max_size) {
38-
_max_size = max_size;
37+
create_collection& create_collection::collation(bsoncxx::document::view_or_value collation) {
38+
_collation = std::move(collation);
3939
return *this;
4040
}
4141

@@ -44,19 +44,19 @@ create_collection& create_collection::max(int max_documents) {
4444
return *this;
4545
}
4646

47-
create_collection& create_collection::collation(bsoncxx::document::view_or_value collation) {
48-
_collation = std::move(collation);
47+
create_collection& create_collection::no_padding(bool no_padding) {
48+
_no_padding = no_padding;
4949
return *this;
5050
}
5151

52-
create_collection& create_collection::storage_engine(
53-
bsoncxx::document::view_or_value storage_engine_opts) {
54-
_storage_engine_opts = std::move(storage_engine_opts);
52+
create_collection& create_collection::size(int max_size) {
53+
_max_size = max_size;
5554
return *this;
5655
}
5756

58-
create_collection& create_collection::no_padding(bool no_padding) {
59-
_no_padding = no_padding;
57+
create_collection& create_collection::storage_engine(
58+
bsoncxx::document::view_or_value storage_engine_opts) {
59+
_storage_engine_opts = std::move(storage_engine_opts);
6060
return *this;
6161
}
6262

@@ -65,69 +65,69 @@ create_collection& create_collection::validation_criteria(class validation_crite
6565
return *this;
6666
}
6767

68-
const stdx::optional<bool>& create_collection::capped() const {
69-
return _capped;
70-
}
71-
7268
const stdx::optional<bool>& create_collection::auto_index_id() const {
7369
return _auto_index_id;
7470
}
7571

76-
const stdx::optional<int>& create_collection::size() const {
77-
return _max_size;
78-
}
79-
80-
const stdx::optional<int>& create_collection::max() const {
81-
return _max_documents;
72+
const stdx::optional<bool>& create_collection::capped() const {
73+
return _capped;
8274
}
8375

8476
const stdx::optional<bsoncxx::document::view_or_value>& create_collection::collation() const {
8577
return _collation;
8678
}
8779

88-
const stdx::optional<bsoncxx::document::view_or_value>& create_collection::storage_engine() const {
89-
return _storage_engine_opts;
80+
const stdx::optional<int>& create_collection::max() const {
81+
return _max_documents;
9082
}
9183

9284
const stdx::optional<bool>& create_collection::no_padding() const {
9385
return _no_padding;
9486
}
9587

88+
const stdx::optional<int>& create_collection::size() const {
89+
return _max_size;
90+
}
91+
92+
const stdx::optional<bsoncxx::document::view_or_value>& create_collection::storage_engine() const {
93+
return _storage_engine_opts;
94+
}
95+
9696
const stdx::optional<class validation_criteria>& create_collection::validation_criteria() const {
9797
return _validation;
9898
}
9999

100100
bsoncxx::document::value create_collection::to_document() const {
101101
auto doc = bsoncxx::builder::stream::document{};
102102

103-
if (_capped) {
104-
doc << "capped" << *_capped;
105-
}
106-
107103
if (_auto_index_id) {
108104
doc << "autoIndexId" << *_auto_index_id;
109105
}
110106

111-
if (_max_size) {
112-
doc << "size" << *_max_size;
113-
}
114-
115-
if (_max_documents) {
116-
doc << "max" << *_max_documents;
107+
if (_capped) {
108+
doc << "capped" << *_capped;
117109
}
118110

119111
if (_collation) {
120112
doc << "collation" << bsoncxx::types::b_document{*_collation};
121113
}
122114

123-
if (_storage_engine_opts) {
124-
doc << "storageEngine" << bsoncxx::types::b_document{*_storage_engine_opts};
115+
if (_max_documents) {
116+
doc << "max" << *_max_documents;
117+
}
118+
119+
if (_max_size) {
120+
doc << "size" << *_max_size;
125121
}
126122

127123
if (_no_padding) {
128124
doc << "flags" << (*_no_padding ? 0x10 : 0x00);
129125
}
130126

127+
if (_storage_engine_opts) {
128+
doc << "storageEngine" << bsoncxx::types::b_document{*_storage_engine_opts};
129+
}
130+
131131
if (_validation) {
132132
doc << bsoncxx::builder::stream::concatenate(_validation->to_document());
133133
}

src/mongocxx/options/create_collection.hpp

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ namespace options {
3030
///
3131
class MONGOCXX_API create_collection {
3232
public:
33+
///
34+
/// Specify false to disable the automatic creation of an index on the _id field.
35+
///
36+
/// @note For replica sets, all collections must have autoIndexId set to true.
37+
///
38+
/// @param auto_index_id
39+
/// Whether or not this collection will automatically generate an index on _id.
40+
///
41+
create_collection& auto_index_id(bool auto_index_id);
42+
43+
///
44+
/// Gets the current auto_index_id setting.
45+
///
46+
/// @return
47+
/// Whether or not this collection will automatically generate an index on _id.
48+
///
49+
const stdx::optional<bool>& auto_index_id() const;
50+
3351
///
3452
/// To create a capped collection, specify true.
3553
///
@@ -53,43 +71,26 @@ class MONGOCXX_API create_collection {
5371
const stdx::optional<bool>& capped() const;
5472

5573
///
56-
/// Specify false to disable the automatic creation of an index on the _id field.
74+
/// Sets the default collation for this collection.
5775
///
58-
/// @note For replica sets, all collections must have autoIndexId set to true.
76+
/// @param collation
77+
/// The default collation for the collection.
5978
///
60-
/// @param auto_index_id
61-
/// Whether or not this collection will automatically generate an index on _id.
79+
/// @see
80+
/// https://docs.mongodb.com/master/reference/collation/
6281
///
63-
create_collection& auto_index_id(bool auto_index_id);
82+
create_collection& collation(bsoncxx::document::view_or_value collation);
6483

6584
///
66-
/// Gets the current auto_index_id setting.
85+
/// Gets the default collation for this collection.
6786
///
6887
/// @return
69-
/// Whether or not this collection will automatically generate an index on _id.
70-
///
71-
const stdx::optional<bool>& auto_index_id() const;
72-
73-
///
74-
/// A maximum size, in bytes, for a capped collection.
75-
///
76-
/// @note Once a capped collection reaches its maximum size, MongoDB removes older
77-
/// documents to make space for new documents.
78-
///
79-
/// @note Size is required for capped collections and ignored for other collections.
80-
///
81-
/// @param max_size
82-
/// Maximum size, in bytes, of this collection (if capped).
83-
///
84-
create_collection& size(int max_size);
85-
86-
///
87-
/// Gets the current size setting, for a capped collection.
88+
/// The default collation for the collection.
8889
///
89-
/// @return
90-
/// Maximum size, in bytes, of this collection (if capped).
90+
/// @see
91+
/// https://docs.mongodb.com/master/reference/collation/
9192
///
92-
const stdx::optional<int>& size() const;
93+
const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
9394

9495
///
9596
/// The maximum number of documents allowed in the capped collection.
@@ -113,64 +114,63 @@ class MONGOCXX_API create_collection {
113114
const stdx::optional<int>& max() const;
114115

115116
///
116-
/// Sets the default collation for this collection.
117+
/// When true, disables the power of 2 sizes allocation for the collection.
117118
///
118-
/// @param collation
119-
/// The default collation for the collection.
119+
/// @see https://docs.mongodb.org/manual/reference/method/db.createCollection/
120120
///
121-
/// @see
122-
/// https://docs.mongodb.com/master/reference/collation/
121+
/// @param no_padding
122+
/// When true, disables power of 2 sizing for this collection.
123123
///
124-
create_collection& collation(bsoncxx::document::view_or_value collation);
124+
create_collection& no_padding(bool no_padding);
125125

126126
///
127-
/// Gets the default collation for this collection.
127+
/// Gets the current value of the "no padding" option for the collection.
128128
///
129-
/// @return
130-
/// The default collation for the collection.
129+
/// @see https://docs.mongodb.org/manual/reference/method/db.createCollection/
131130
///
132-
/// @see
133-
/// https://docs.mongodb.com/master/reference/collation/
131+
/// @return
132+
/// When true, power of 2 sizing is disabled for this collection.
134133
///
135-
const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
134+
const stdx::optional<bool>& no_padding() const;
136135

137136
///
138-
/// Specify configuration to the storage on a per-collection basis.
137+
/// A maximum size, in bytes, for a capped collection.
139138
///
140-
/// @note This option is currently only available with the WiredTiger storage engine.
139+
/// @note Once a capped collection reaches its maximum size, MongoDB removes older
140+
/// documents to make space for new documents.
141141
///
142-
/// @param storage_engine_options
143-
/// Configuration options specific to the storage engine.
142+
/// @note Size is required for capped collections and ignored for other collections.
144143
///
145-
create_collection& storage_engine(bsoncxx::document::view_or_value storage_engine_opts);
144+
/// @param max_size
145+
/// Maximum size, in bytes, of this collection (if capped).
146+
///
147+
create_collection& size(int max_size);
146148

147149
///
148-
/// Gets the current storage engine configuration for this collection.
150+
/// Gets the current size setting, for a capped collection.
149151
///
150152
/// @return
151-
/// Configuration options specific to the storage engine.
153+
/// Maximum size, in bytes, of this collection (if capped).
152154
///
153-
const stdx::optional<bsoncxx::document::view_or_value>& storage_engine() const;
155+
const stdx::optional<int>& size() const;
154156

155157
///
156-
/// When true, disables the power of 2 sizes allocation for the collection.
158+
/// Specify configuration to the storage on a per-collection basis.
157159
///
158-
/// @see https://docs.mongodb.org/manual/reference/method/db.createCollection/
160+
/// @note This option is currently only available with the WiredTiger storage engine.
159161
///
160-
/// @param no_padding
161-
/// When true, disables power of 2 sizing for this collection.
162+
/// @param storage_engine_options
163+
/// Configuration options specific to the storage engine.
162164
///
163-
create_collection& no_padding(bool no_padding);
165+
create_collection& storage_engine(bsoncxx::document::view_or_value storage_engine_opts);
164166

165167
///
166-
/// Gets the current value of the "no padding" option for the collection.
167-
///
168-
/// @see https://docs.mongodb.org/manual/reference/method/db.createCollection/
168+
/// Gets the current storage engine configuration for this collection.
169169
///
170170
/// @return
171-
/// When true, power of 2 sizing is disabled for this collection.
171+
/// Configuration options specific to the storage engine.
172172
///
173-
const stdx::optional<bool>& no_padding() const;
173+
const stdx::optional<bsoncxx::document::view_or_value>& storage_engine() const;
174174

175175
///
176176
/// Specify validation criteria for this collection.
@@ -211,13 +211,13 @@ class MONGOCXX_API create_collection {
211211
MONGOCXX_INLINE operator bsoncxx::document::value() const;
212212

213213
private:
214-
stdx::optional<bool> _capped;
215214
stdx::optional<bool> _auto_index_id;
216-
stdx::optional<int> _max_size;
217-
stdx::optional<int> _max_documents;
215+
stdx::optional<bool> _capped;
218216
stdx::optional<bsoncxx::document::view_or_value> _collation;
219-
stdx::optional<bsoncxx::document::view_or_value> _storage_engine_opts;
217+
stdx::optional<int> _max_documents;
218+
stdx::optional<int> _max_size;
220219
stdx::optional<bool> _no_padding;
220+
stdx::optional<bsoncxx::document::view_or_value> _storage_engine_opts;
221221
stdx::optional<class validation_criteria> _validation;
222222
};
223223

0 commit comments

Comments
 (0)