Table of Contents

Class CollectionOptions

Namespace
MongoDB.Driver.Builders
Assembly
MongoDB.Driver.Legacy.dll

A builder for the options used when creating a collection.

public static class CollectionOptions
Inheritance
CollectionOptions
Inherited Members

Properties

Null

Gets a null value with a type of IMongoCollectionOptions.

public static IMongoCollectionOptions Null { get; }

Property Value

IMongoCollectionOptions

Methods

SetAutoIndexId(bool)

Sets whether to automatically create an index on the _id element.

[Obsolete("AutoIndexId has been deprecated since server version 3.2.")]
public static CollectionOptionsBuilder SetAutoIndexId(bool value)

Parameters

value bool

Whether to automatically create an index on the _id element.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetCapped(bool)

Sets whether the collection is capped.

public static CollectionOptionsBuilder SetCapped(bool value)

Parameters

value bool

Whether the collection is capped.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetCollation(Collation)

Sets the collation.

public static CollectionOptionsBuilder SetCollation(Collation value)

Parameters

value Collation

The collation.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetIndexOptionDefaults(IndexOptionDefaults)

Sets the index options defaults.

public static CollectionOptionsBuilder SetIndexOptionDefaults(IndexOptionDefaults value)

Parameters

value IndexOptionDefaults

The value.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetMaxDocuments(long)

Sets the max number of documents in a capped collection.

public static CollectionOptionsBuilder SetMaxDocuments(long value)

Parameters

value long

The max number of documents.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetMaxSize(long)

Sets the max size of a capped collection.

public static CollectionOptionsBuilder SetMaxSize(long value)

Parameters

value long

The max size.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetStorageEngineOptions(BsonDocument)

Sets the storage engine options.

public static CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument value)

Parameters

value BsonDocument

The value.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetValidationAction(DocumentValidationAction)

Sets the validation action.

public static CollectionOptionsBuilder SetValidationAction(DocumentValidationAction validationAction)

Parameters

validationAction DocumentValidationAction

The validation action.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetValidationLevel(DocumentValidationLevel)

Sets the validation level.

public static CollectionOptionsBuilder SetValidationLevel(DocumentValidationLevel validationLevel)

Parameters

validationLevel DocumentValidationLevel

The validation level.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).

SetValidator(IMongoQuery)

Sets the validator.

public static CollectionOptionsBuilder SetValidator(IMongoQuery validator)

Parameters

validator IMongoQuery

The validator.

Returns

CollectionOptionsBuilder

The builder (so method calls can be chained).