Method CreateEncryptedCollection
- Namespace
- MongoDB.Driver.Encryption
- Assembly
- MongoDB.Driver.Encryption.dll
CreateEncryptedCollection(IMongoDatabase, string, CreateCollectionOptions, string, DataKeyOptions, CancellationToken)
Create encrypted collection.
[Obsolete("Use the overload with masterKey instead.")]
public CreateEncryptedCollectionResult CreateEncryptedCollection(IMongoDatabase database, string collectionName, CreateCollectionOptions createCollectionOptions, string kmsProvider, DataKeyOptions dataKeyOptions, CancellationToken cancellationToken = default)
Parameters
databaseIMongoDatabaseThe database.
collectionNamestringThe collection name.
createCollectionOptionsCreateCollectionOptionsThe create collection options.
kmsProviderstringThe kms provider.
dataKeyOptionsDataKeyOptionsThe datakey options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- 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.
CreateEncryptedCollection(IMongoDatabase, string, CreateCollectionOptions, string, BsonDocument, CancellationToken)
Create encrypted collection.
public CreateEncryptedCollectionResult CreateEncryptedCollection(IMongoDatabase database, string collectionName, CreateCollectionOptions createCollectionOptions, string kmsProvider, BsonDocument masterKey, CancellationToken cancellationToken = default)
Parameters
databaseIMongoDatabaseThe database.
collectionNamestringThe collection name.
createCollectionOptionsCreateCollectionOptionsThe create collection options.
kmsProviderstringThe kms provider.
masterKeyBsonDocumentThe master key.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- 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.