Class CollectionOptionsBuilder
A builder for the options used when creating a collection.
[Serializable]
[BsonSerializer(typeof(CollectionOptionsBuilder.Serializer))]
public class CollectionOptionsBuilder : BuilderBase, IConvertibleToBsonDocument, IMongoCollectionOptions
- Inheritance
-
CollectionOptionsBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
CollectionOptionsBuilder()
Initializes a new instance of the CollectionOptionsBuilder class.
public CollectionOptionsBuilder()
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 CollectionOptionsBuilder SetAutoIndexId(bool value)
Parameters
valueboolWhether 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 CollectionOptionsBuilder SetCapped(bool value)
Parameters
valueboolWhether the collection is capped.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetCollation(Collation)
Sets the collation.
public CollectionOptionsBuilder SetCollation(Collation value)
Parameters
valueCollationThe collation.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetIndexOptionDefaults(IndexOptionDefaults)
Sets the index options defaults.
public CollectionOptionsBuilder SetIndexOptionDefaults(IndexOptionDefaults value)
Parameters
valueIndexOptionDefaultsThe index options defaults.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetMaxDocuments(long)
Sets the max number of documents in a capped collection.
public CollectionOptionsBuilder SetMaxDocuments(long value)
Parameters
valuelongThe 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 CollectionOptionsBuilder SetMaxSize(long value)
Parameters
valuelongThe max size.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetStorageEngineOptions(BsonDocument)
Sets the storage engine options.
public CollectionOptionsBuilder SetStorageEngineOptions(BsonDocument value)
Parameters
valueBsonDocumentThe value.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetValidationAction(DocumentValidationAction)
Sets the validation action.
public CollectionOptionsBuilder SetValidationAction(DocumentValidationAction validationAction)
Parameters
validationActionDocumentValidationActionThe validation action.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetValidationLevel(DocumentValidationLevel)
Sets the validation level.
public CollectionOptionsBuilder SetValidationLevel(DocumentValidationLevel validationLevel)
Parameters
validationLevelDocumentValidationLevelThe validation level.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
SetValidator(IMongoQuery)
Sets the validator.
public CollectionOptionsBuilder SetValidator(IMongoQuery validator)
Parameters
validatorIMongoQueryThe validator.
Returns
- CollectionOptionsBuilder
The builder (so method calls can be chained).
ToBsonDocument()
Returns the result of the builder as a BsonDocument.
public override BsonDocument ToBsonDocument()
Returns
- BsonDocument
A BsonDocument.