CSFLE of Array Contents

How can I encrypt a mongo db array contents using CSFLE.

I cannot encrypt the whole array of contents. Here I need to encrypt a few fields in the array objects.

How to give the schemaMap prepared in this case.

I tried to create items and gave encrypt inside schema inside it but no luck.

Welcome to the MongoDB Community Forums @Vikas_P_R !

Per the encrypt schema documentation for automatic field-level encryption:

encrypt cannot be specified within any subschema of the items or additionalItems keywords. Specifically, automatic client-side field level encryption does not support encrypting individual elements of an array.

If you currently have an array mixing values that need to be encrypted with those that do not, I recommend separating the values into two arrays in your data model so you can use automatic field-level encryption.

An alternative approach would be to use Explicit (Manual) Client-Side Field Level Encryption, but this would require modifying your application code to include encryption/decryption logic in relevant read & write operations.

Regards,
Stennie