Click or drag to resize

ClientEncryptionCreateEncryptedCollection Method

Create encrypted collection.

Namespace:  MongoDB.Driver.Encryption
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.19.1+3a2a09dd959482f665ffbb5df2557ec541597af4
Syntax
public CreateEncryptedCollectionResult CreateEncryptedCollection(
	IMongoDatabase database,
	string collectionName,
	CreateCollectionOptions createCollectionOptions,
	string kmsProvider,
	DataKeyOptions dataKeyOptions,
	CancellationToken cancellationToken = default
)

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.
dataKeyOptions
Type: MongoDB.Driver.EncryptionDataKeyOptions
The datakey options.
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 assigned to keyId value.
See Also