Method CreateEncryptedCollectionAsync
- Namespace
- MongoDB.Driver.Encryption
- Assembly
- MongoDB.Driver.Encryption.dll
CreateEncryptedCollectionAsync(IMongoDatabase, string, CreateCollectionOptions, string, DataKeyOptions, CancellationToken)
Create encrypted collection.
[Obsolete("Use the overload with masterKey instead.")]
public Task<CreateEncryptedCollectionResult> CreateEncryptedCollectionAsync(IMongoDatabase database, string collectionName, CreateCollectionOptions createCollectionOptions, string kmsProvider, DataKeyOptions dataKeyOptions, CancellationToken cancellationToken = default)
Parameters
database
IMongoDatabaseThe database.
collectionName
stringThe collection name.
createCollectionOptions
CreateCollectionOptionsThe create collection options.
kmsProvider
stringThe kms provider.
dataKeyOptions
DataKeyOptionsThe datakey options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<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.
CreateEncryptedCollectionAsync(IMongoDatabase, string, CreateCollectionOptions, string, BsonDocument, CancellationToken)
Create encrypted collection.
public Task<CreateEncryptedCollectionResult> CreateEncryptedCollectionAsync(IMongoDatabase database, string collectionName, CreateCollectionOptions createCollectionOptions, string kmsProvider, BsonDocument masterKey, CancellationToken cancellationToken = default)
Parameters
database
IMongoDatabaseThe database.
collectionName
stringThe collection name.
createCollectionOptions
CreateCollectionOptionsThe create collection options.
kmsProvider
stringThe kms provider.
masterKey
BsonDocumentThe master key.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<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.