MongoDB C++ Driver  mongocxx-3.1.0
Public Member Functions | List of all members
mongocxx::options::create_collection Class Reference

Class representing the optional arguments to a MongoDB createCollection command. More...

#include <create_collection.hpp>

Public Member Functions

create_collectionauto_index_id (bool auto_index_id)
 Specify false to disable the automatic creation of an index on the _id field. More...
 
const stdx::optional< bool > & auto_index_id () const
 Gets the current auto_index_id setting. More...
 
create_collectioncapped (bool capped)
 To create a capped collection, specify true. More...
 
const stdx::optional< bool > & capped () const
 Gets the current capped setting. More...
 
create_collectioncollation (bsoncxx::document::view_or_value collation)
 Sets the default collation for this collection. More...
 
const stdx::optional< bsoncxx::document::view_or_value > & collation () const
 Gets the default collation for this collection. More...
 
create_collectionmax (int max_documents)
 The maximum number of documents allowed in the capped collection. More...
 
const stdx::optional< int > & max () const
 Gets the current setting for the maximum number of documents allowed in the capped collection. More...
 
create_collectionno_padding (bool no_padding)
 When true, disables the power of 2 sizes allocation for the collection. More...
 
const stdx::optional< bool > & no_padding () const
 Gets the current value of the "no padding" option for the collection. More...
 
create_collectionsize (int max_size)
 A maximum size, in bytes, for a capped collection. More...
 
const stdx::optional< int > & size () const
 Gets the current size setting, for a capped collection. More...
 
create_collectionstorage_engine (bsoncxx::document::view_or_value storage_engine_opts)
 Specify configuration to the storage on a per-collection basis. More...
 
const stdx::optional< bsoncxx::document::view_or_value > & storage_engine () const
 Gets the current storage engine configuration for this collection. More...
 
create_collectionvalidation_criteria (class validation_criteria validation)
 Specify validation criteria for this collection. More...
 
const stdx::optional< class validation_criteria > & validation_criteria () const
 Gets the current validation criteria for this collection. More...
 
bsoncxx::document::value to_document () const
 Return a bson document representing the options set on this object. More...
 
 operator bsoncxx::document::value () const
 

Detailed Description

Class representing the optional arguments to a MongoDB createCollection command.

Member Function Documentation

create_collection& mongocxx::options::create_collection::auto_index_id ( bool  auto_index_id)

Specify false to disable the automatic creation of an index on the _id field.

Note
For replica sets, all collections must have autoIndexId set to true.
Parameters
auto_index_idWhether or not this collection will automatically generate an index on _id.
const stdx::optional<bool>& mongocxx::options::create_collection::auto_index_id ( ) const

Gets the current auto_index_id setting.

Returns
Whether or not this collection will automatically generate an index on _id.
create_collection& mongocxx::options::create_collection::capped ( bool  capped)

To create a capped collection, specify true.

Note
If you specify true, you must also set a maximum size using the size() method.
Parameters
cappedWhether or not this collection will be capped.
See also
https://docs.mongodb.com/master/reference/glossary/#term-capped-collection
const stdx::optional<bool>& mongocxx::options::create_collection::capped ( ) const

Gets the current capped setting.

Returns
Whether or not this collection will be capped.
See also
https://docs.mongodb.com/master/reference/glossary/#term-capped-collection
create_collection& mongocxx::options::create_collection::collation ( bsoncxx::document::view_or_value  collation)

Sets the default collation for this collection.

Parameters
collationThe default collation for the collection.
See also
https://docs.mongodb.com/master/reference/collation/
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::create_collection::collation ( ) const

Gets the default collation for this collection.

Returns
The default collation for the collection.
See also
https://docs.mongodb.com/master/reference/collation/
create_collection& mongocxx::options::create_collection::max ( int  max_documents)

The maximum number of documents allowed in the capped collection.

Note
The size limit takes precedence over this limit. If a capped collection reaches the size limit before it reaches the maximum number of documents, MongoDB removes old documents.
Parameters
max_documentsMaximum number of documents allowed in the collection (if capped).
const stdx::optional<int>& mongocxx::options::create_collection::max ( ) const

Gets the current setting for the maximum number of documents allowed in the capped collection.

Returns
Maximum number of documents allowed in the collection (if capped).
create_collection& mongocxx::options::create_collection::no_padding ( bool  no_padding)

When true, disables the power of 2 sizes allocation for the collection.

See also
https://docs.mongodb.com/master/reference/method/db.createCollection/
Parameters
no_paddingWhen true, disables power of 2 sizing for this collection.
const stdx::optional<bool>& mongocxx::options::create_collection::no_padding ( ) const

Gets the current value of the "no padding" option for the collection.

See also
https://docs.mongodb.com/master/reference/method/db.createCollection/
Returns
When true, power of 2 sizing is disabled for this collection.
mongocxx::options::create_collection::operator bsoncxx::document::value ( ) const
Deprecated:
This method is deprecated. To determine which options are set on this object, use the provided accessors instead.
create_collection& mongocxx::options::create_collection::size ( int  max_size)

A maximum size, in bytes, for a capped collection.

Note
Once a capped collection reaches its maximum size, MongoDB removes older documents to make space for new documents.
Size is required for capped collections and ignored for other collections.
Parameters
max_sizeMaximum size, in bytes, of this collection (if capped).
const stdx::optional<int>& mongocxx::options::create_collection::size ( ) const

Gets the current size setting, for a capped collection.

Returns
Maximum size, in bytes, of this collection (if capped).
create_collection& mongocxx::options::create_collection::storage_engine ( bsoncxx::document::view_or_value  storage_engine_opts)

Specify configuration to the storage on a per-collection basis.

Note
This option is currently only available with the WiredTiger storage engine.
Parameters
storage_engine_optionsConfiguration options specific to the storage engine.
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::create_collection::storage_engine ( ) const

Gets the current storage engine configuration for this collection.

Returns
Configuration options specific to the storage engine.
bsoncxx::document::value mongocxx::options::create_collection::to_document ( ) const

Return a bson document representing the options set on this object.

Deprecated:
This method is deprecated. To determine which options are set on this object, use the provided accessors instead.
Returns
Options, as a document.
create_collection& mongocxx::options::create_collection::validation_criteria ( class validation_criteria  validation)

Specify validation criteria for this collection.

Parameters
validationValidation criteria for this collection.
See also
https://docs.mongodb.com/master/core/document-validation/
const stdx::optional<class validation_criteria>& mongocxx::options::create_collection::validation_criteria ( ) const

Gets the current validation criteria for this collection.

Returns
Validation criteria for this collection.
See also
https://docs.mongodb.com/master/core/document-validation/

The documentation for this class was generated from the following file: