Struct mongodb::options::CreateCollectionOptions[][src]

#[non_exhaustive]
pub struct CreateCollectionOptions { pub capped: Option<bool>, pub size: Option<u64>, pub max: Option<u64>, pub storage_engine: Option<Document>, pub validator: Option<Document>, pub validation_level: Option<ValidationLevel>, pub validation_action: Option<ValidationAction>, pub view_on: Option<String>, pub pipeline: Option<Vec<Document>>, pub collation: Option<Collation>, pub write_concern: Option<WriteConcern>, pub index_option_defaults: Option<IndexOptionDefaults>, }
Expand description

These are the valid options for creating a collection with Database::create_collection.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
capped: Option<bool>

Whether the collection should be capped. If true, size must also be set.

size: Option<u64>

The maximum size (in bytes) for a capped collection. This option is ignored if capped is not set to true.

max: Option<u64>

The maximum number of documents in a capped collection. The size limit takes precedence over this option. If a capped collection reaches the size limit before it reaches the maximum number of documents, MongoDB removes old documents.

storage_engine: Option<Document>

The storage engine that the collection should use. The value should take the following form:

{ <storage-engine-name>: <options> }

validator: Option<Document>

Specifies a validator to restrict the schema of documents which can exist in the collection. Expressions can be specified using any query operators except $near, $nearSphere, $text, and $where.

validation_level: Option<ValidationLevel>

Specifies how strictly the database should apply the validation rules to existing documents during an update.

validation_action: Option<ValidationAction>

Specifies whether the database should return an error or simply raise a warning if inserted documents do not pass the validation.

view_on: Option<String>

The name of the source collection or view to base this view on. If specified, this will cause a view to be created rather than a collection.

pipeline: Option<Vec<Document>>

An array that consists of the aggregation pipeline stages to run against view_on to determine the contents of the view.

collation: Option<Collation>

The default collation for the collection or view.

write_concern: Option<WriteConcern>

The write concern for the operation.

index_option_defaults: Option<IndexOptionDefaults>

The default configuration for indexes created on this collection, including the _id index.

Implementations

impl CreateCollectionOptions[src]

pub fn builder(
) -> CreateCollectionOptionsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
[src]

Create a builder for building CreateCollectionOptions. On the builder, call .capped(...)(optional), .size(...)(optional), .max(...)(optional), .storage_engine(...)(optional), .validator(...)(optional), .validation_level(...)(optional), .validation_action(...)(optional), .view_on(...)(optional), .pipeline(...)(optional), .collation(...)(optional), .write_concern(...)(optional), .index_option_defaults(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of CreateCollectionOptions.

Trait Implementations

impl Clone for CreateCollectionOptions[src]

fn clone(&self) -> CreateCollectionOptions[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for CreateCollectionOptions[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for CreateCollectionOptions[src]

fn default() -> CreateCollectionOptions[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for CreateCollectionOptions[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for CreateCollectionOptions[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]