Sorting on Field Level Encrypted column

MongoDB provides “Client-Side Field Level Encryption” for encrypting and decrypting specific field in collection.
MongoDB FLE implementation does not perform any encryption and decryption operations on the database server. Instead, these operations are performed by the MongoDB client library, also known as the driver. Now for supporting sorting operation on the encrypted field, all data from the MongoDB has to brought to driver and after decrypting the field sorting can only be applied. Which leads to performance degradation.
Please suggest how to perform sorting on a field level encrypted column?

Hi @Vikrant_Tiwari, and welcome to the forum!

Depending on your use case, you could encrypt only fields containing sensitive information. Applications can still query and sort the result on the server using other unencrypted non-sensitive information on the document.

The general notion of MongoDB Client-Side Field Level Encryption is that the server never sees the unencrypted values.

Maybe what you are looking for is MongoDB Encryption At Rest ? This feature allows MongoDB server to encrypt data files such that only parties with the decryption key can decode and read the data.

Regards,
Wan.

2 Likes