MongoDB C++ Driver  mongocxx-3.7.0
create_collection.hpp
1 // Copyright 2015 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 
15 #pragma once
16 
17 #include <bsoncxx/document/view_or_value.hpp>
18 #include <bsoncxx/stdx/optional.hpp>
19 #include <mongocxx/stdx.hpp>
20 #include <mongocxx/validation_criteria.hpp>
21 
22 #include <mongocxx/config/prelude.hpp>
23 
24 namespace mongocxx {
25 MONGOCXX_INLINE_NAMESPACE_BEGIN
26 namespace options {
27 
35 class MONGOCXX_API create_collection_deprecated {
36  public:
51  create_collection_deprecated& capped(bool capped);
52 
61  const stdx::optional<bool>& capped() const;
62 
77 
87  const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
88 
103  create_collection_deprecated& max(std::int64_t max_documents);
104 
112  const stdx::optional<std::int64_t>& max() const;
113 
126  create_collection_deprecated& no_padding(bool no_padding);
127 
136  const stdx::optional<bool>& no_padding() const;
137 
153  create_collection_deprecated& size(std::int64_t max_size);
154 
161  const stdx::optional<std::int64_t>& size() const;
162 
175  create_collection_deprecated& storage_engine(
176  bsoncxx::document::view_or_value storage_engine_opts);
177 
184  const stdx::optional<bsoncxx::document::view_or_value>& storage_engine() const;
185 
199 
208  const stdx::optional<class validation_criteria>& validation_criteria() const;
209 
219  MONGOCXX_DEPRECATED bsoncxx::document::value to_document() const;
220  bsoncxx::document::value to_document_deprecated() const;
221 
227  MONGOCXX_DEPRECATED MONGOCXX_INLINE operator bsoncxx::document::value() const;
228 
229  private:
230  stdx::optional<bool> _capped;
231  stdx::optional<bsoncxx::document::view_or_value> _collation;
232  stdx::optional<std::int64_t> _max_documents;
233  stdx::optional<std::int64_t> _max_size;
234  stdx::optional<bool> _no_padding;
235  stdx::optional<bsoncxx::document::view_or_value> _storage_engine_opts;
236  stdx::optional<class validation_criteria> _validation;
237 };
238 
239 MONGOCXX_DEPRECATED typedef create_collection_deprecated create_collection;
240 
241 MONGOCXX_INLINE create_collection_deprecated::operator bsoncxx::document::value() const {
242  return to_document_deprecated();
243 }
244 
245 } // namespace options
246 MONGOCXX_INLINE_NAMESPACE_END
247 } // namespace mongocxx
248 
249 #include <mongocxx/config/postlude.hpp>
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
bsoncxx::view_or_value
Class representing a view-or-value variant type.
Definition: view_or_value.hpp:30
mongocxx::options::create_collection_deprecated
Class representing the optional arguments to a MongoDB createCollection command.
Definition: create_collection.hpp:35
bsoncxx::document::value
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:34
mongocxx::validation_criteria
Class representing criteria for document validation, to be applied to a collection.
Definition: validation_criteria.hpp:31