Click or drag to resize

ClientEncryptionCreateEncryptedCollection Method (IMongoDatabase, String, CreateCollectionOptions, String, BsonDocument, CancellationToken)

Create encrypted collection.

Namespace:  MongoDB.Driver.Encryption
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.20.0+ee01960089f28ea1b501690df5fc9f6318a70242
Syntax
public CreateEncryptedCollectionResult CreateEncryptedCollection(
	IMongoDatabase database,
	string collectionName,
	CreateCollectionOptions createCollectionOptions,
	string kmsProvider,
	BsonDocument masterKey,
	CancellationToken cancellationToken = null
)

Parameters

database
Type: MongoDB.DriverIMongoDatabase
The database.
collectionName
Type: SystemString
The collection name.
createCollectionOptions
Type: MongoDB.DriverCreateCollectionOptions
The create collection options.
kmsProvider
Type: SystemString
The kms provider.
masterKey
Type: MongoDB.BsonBsonDocument
The master key.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Return Value

Type: CreateEncryptedCollectionResult
The operation result.
Remarks
If EncryptionFields contains a keyId with a null value, a data key will be automatically generated and returned in EncryptedFields.
See Also