MongoDB C++ Driver  mongocxx-3.6.2
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
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:
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 
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 
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::options::create_collection_deprecated::max
create_collection_deprecated & max(std::int64_t max_documents)
The maximum number of documents allowed in the capped collection.
mongocxx::options::create_collection_deprecated::size
const stdx::optional< std::int64_t > & size() const
Gets the current size setting, for a capped collection.
mongocxx::options::create_collection_deprecated::to_document
MONGOCXX_DEPRECATED bsoncxx::document::value to_document() const
Return a bson document representing the options set on this object.
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
mongocxx::options::create_collection_deprecated::no_padding
create_collection_deprecated & no_padding(bool no_padding)
When true, disables the power of 2 sizes allocation for the collection.
mongocxx::options::create_collection_deprecated::no_padding
const stdx::optional< bool > & no_padding() const
Gets the current value of the "no padding" option for the collection.
bsoncxx::document::value
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:33
mongocxx::options::create_collection_deprecated::capped
const stdx::optional< bool > & capped() const
Gets the current capped setting.
mongocxx::validation_criteria
Class representing criteria for document validation, to be applied to a collection.
Definition: validation_criteria.hpp:31
mongocxx::options::create_collection_deprecated::collation
create_collection_deprecated & collation(bsoncxx::document::view_or_value collation)
Sets the default collation for this collection.
mongocxx::options::create_collection_deprecated::max
const stdx::optional< std::int64_t > & max() const
Gets the current setting for the maximum number of documents allowed in the capped collection.
mongocxx::options::create_collection_deprecated::validation_criteria
const stdx::optional< class validation_criteria > & validation_criteria() const
Gets the current validation criteria for this collection.
mongocxx::options::create_collection_deprecated::validation_criteria
create_collection_deprecated & validation_criteria(class validation_criteria validation)
Specify validation criteria for this collection.
mongocxx::options::create_collection_deprecated::storage_engine
const stdx::optional< bsoncxx::document::view_or_value > & storage_engine() const
Gets the current storage engine configuration for this collection.
mongocxx::options::create_collection_deprecated::size
create_collection_deprecated & size(std::int64_t max_size)
A maximum size, in bytes, for a capped collection.
mongocxx::options::create_collection_deprecated::capped
create_collection_deprecated & capped(bool capped)
To create a capped collection, specify true.
mongocxx::options::create_collection_deprecated::collation
const stdx::optional< bsoncxx::document::view_or_value > & collation() const
Gets the default collation for this collection.
mongocxx::options::create_collection_deprecated::storage_engine
create_collection_deprecated & storage_engine(bsoncxx::document::view_or_value storage_engine_opts)
Specify configuration to the storage on a per-collection basis.