Bad developer experience for field encryption with .NET in C#

Hey MongoDB C# Driver Team,
I tried out the field encryption feature with the MongoDB C# driver. I would like to be able to easily declare via my C# data classes which fields should be encrypted (Attribute based). Without first having to create a JSON schema that would bloat the code considerably.

I would also like to be able to work without a BsonDocument object. Unfortunately only the examples can be found in your documentation. Also the work with the integration of KMS with own complex dictionaries and magic strings.

Using mongocrypt.dll is also unreasonable. For this, an additional library simply has to be provided via NuGet, which is automatically available to me for the cross-platform client, without extensive setup. That is what I want.

Please please change this complexity. Currently, an own small solution without field encryption is the simplest variant. But then you lose the automatic comfort at all.

I haven’t ventured into Queryable Encryption yet, but I think it was also made so complex.

If you want to pick up and inspire someone with this feature set, please pay attention to a significantly better developer experience.

@Community what is your opinion on this?

Hey @Gregor_Biswanger ,

which fields should be encrypted (Attribute based)

I would also like to be able to work without a BsonDocument object. Unfortunately only the examples can be found in your documentation.

At this point it’s the only way, but we have an improvement ticket to allow better user’s experience in this case. Please follow to this ticket for updates.

Using mongocrypt.dll is also unreasonable. For this, an additional library simply has to be provided via NuGet,

mongocrypt.dll (which is c++ library) is already part of additional nuget called MongoDB.Libmongocrypt. You don’t need any additional steps to work with it, it’s already part of the driver. Do you mean configuring mongocryptd daemon (which is a different binary)? If so, then if you can’t use a default configuration (mainly I mean default binary path and mongocryptd port which is 27020), you should configure it explicitly, however Queryable Encryption provides a way called Shared library that fully supersedes it and allows much easier configuring it, see here for details.

Also the work with the integration of KMS with own complex dictionaries and magic strings.

can you elaborate? It doesn’t require any dictionaries. It only requires specifying data (explicitly or via env variables) required by KMS itself.

Best regards, Dima