MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
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
24namespace mongocxx {
25namespace v_noabi {
26namespace options {
27
35class MONGOCXX_API create_collection_deprecated {
36 public:
52
61 const stdx::optional<bool>& capped() const;
62
77
87 const stdx::optional<bsoncxx::v_noabi::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
177
184 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& storage_engine() const;
185
200
209 const stdx::optional<mongocxx::v_noabi::validation_criteria>& validation_criteria() const;
210
221 bsoncxx::v_noabi::document::value to_document_deprecated() const;
222
228 MONGOCXX_DEPRECATED MONGOCXX_INLINE operator bsoncxx::v_noabi::document::value() const;
229
230 private:
231 stdx::optional<bool> _capped;
232 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
233 stdx::optional<std::int64_t> _max_documents;
234 stdx::optional<std::int64_t> _max_size;
235 stdx::optional<bool> _no_padding;
236 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _storage_engine_opts;
237 stdx::optional<mongocxx::v_noabi::validation_criteria> _validation;
238};
239
240MONGOCXX_DEPRECATED typedef create_collection_deprecated create_collection;
241
242MONGOCXX_INLINE create_collection_deprecated::operator bsoncxx::v_noabi::document::value() const {
243 return to_document_deprecated();
244}
245
246} // namespace options
247} // namespace v_noabi
248} // namespace mongocxx
249
250namespace mongocxx {
251namespace options {
252
253using ::mongocxx::v_noabi::options::create_collection;
254using ::mongocxx::v_noabi::options::create_collection_deprecated;
255
256} // namespace options
257} // namespace mongocxx
258
259#include <mongocxx/config/postlude.hpp>
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:38
Class representing the optional arguments to a MongoDB createCollection command.
Definition create_collection.hpp:35
create_collection_deprecated & validation_criteria(mongocxx::v_noabi::validation_criteria validation)
Specify validation criteria for this collection.
create_collection_deprecated & size(std::int64_t max_size)
A maximum size, in bytes, for a capped collection.
create_collection_deprecated & capped(bool capped)
To create a capped collection, specify true.
create_collection_deprecated & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the default collation for this collection.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & storage_engine() const
Gets the current storage engine configuration for this collection.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation() const
Gets the default collation for this collection.
const stdx::optional< bool > & no_padding() const
Gets the current value of the "no padding" option for the collection.
const stdx::optional< mongocxx::v_noabi::validation_criteria > & validation_criteria() const
Gets the current validation criteria for this collection.
create_collection_deprecated & no_padding(bool no_padding)
When true, disables the power of 2 sizes allocation for the collection.
create_collection_deprecated & max(std::int64_t max_documents)
The maximum number of documents allowed in the capped collection.
const stdx::optional< std::int64_t > & size() const
Gets the current size setting, for a capped collection.
create_collection_deprecated & storage_engine(bsoncxx::v_noabi::document::view_or_value storage_engine_opts)
Specify configuration to the storage on a per-collection basis.
const stdx::optional< std::int64_t > & max() const
Gets the current setting for the maximum number of documents allowed in the capped collection.
bsoncxx::v_noabi::document::value to_document() const
Return a bson document representing the options set on this object.
const stdx::optional< bool > & capped() const
Gets the current capped setting.
Class representing criteria for document validation, to be applied to a collection.
Definition validation_criteria.hpp:33
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19