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
value
boolWhether 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
boolWhether 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
CollationThe 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
IndexOptionDefaultsThe 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
longThe 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
longThe 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
BsonDocumentThe 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
DocumentValidationActionThe 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
DocumentValidationLevelThe 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
IMongoQueryThe validator.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).