ClientEncryptionCreateEncryptedCollectionAsync Method (IMongoDatabase, String, CreateCollectionOptions, String, BsonDocument, CancellationToken) |
Create encrypted collection.
Namespace:
MongoDB.Driver.Encryption
Assembly:
MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.21.0+5a9c3311e158910b88195f290e6d4b1b2715d2b2
Syntax public Task<CreateEncryptedCollectionResult> CreateEncryptedCollectionAsync(
IMongoDatabase database,
string collectionName,
CreateCollectionOptions createCollectionOptions,
string kmsProvider,
BsonDocument masterKey,
CancellationToken cancellationToken = null
)
Public Function CreateEncryptedCollectionAsync (
database As IMongoDatabase,
collectionName As String,
createCollectionOptions As CreateCollectionOptions,
kmsProvider As String,
masterKey As BsonDocument,
Optional cancellationToken As CancellationToken = Nothing
) As Task(Of CreateEncryptedCollectionResult)
member CreateEncryptedCollectionAsync :
database : IMongoDatabase *
collectionName : string *
createCollectionOptions : CreateCollectionOptions *
kmsProvider : string *
masterKey : BsonDocument *
?cancellationToken : CancellationToken
(* Defaults:
let _cancellationToken = defaultArg cancellationToken null
*)
-> Task<CreateEncryptedCollectionResult>
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:
TaskCreateEncryptedCollectionResultThe 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