Class CollectionOptions
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
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
- valuebool
- 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
- valuebool
- 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
- valueCollation
- 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
- valueIndexOptionDefaults
- 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
- valuelong
- 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
- valuelong
- 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
- valueBsonDocument
- 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
- validationActionDocumentValidationAction
- 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
- validationLevelDocumentValidationLevel
- 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
- validatorIMongoQuery
- The validator. 
Returns
- CollectionOptionsBuilder
- The builder (so method calls can be chained).