How to decypt in aggreagation

hi i need how to decrypt in aggregation when I’m encrypted in field level

Could you give an example of what you’d like to do?

actually i encrypted the email field and stored in database and in aggregation i need to decrypt
like this
pipeline = [
‘$project’: {
‘email’: {
‘$decrypt’: {
‘input’: ‘$email’,
‘key’: {
‘provider’: ‘local’,
‘key’: encryption_key

result = DataEmployee.objects().aggregate(*pipeline)
i need to decrypt the email filed in aggregation

but mongocompass show the stage is invalid

The server is intentionally not able to decrypt the field within an aggregation stage. Only the application is able to decrypt the data. This is the purpose of client side field level encryption. Why do you want to decrypt the data within the aggregation pipeline?

1 Like


This isn’t something that would be done in an aggregation but by application, also, if you’re doing the Luxlin hacking tutorial, MongoDB patched all of that already months ago in the last security patch.

The last update to the Realm React Native SDK also cut off the ability to intercept the in client aggregations in this same manner as well.

The Luxlin hacking tutorial is no longer a working guide, if that’s what you’re following to do this. Just an FYI.

BrnP4LMs and TVCOD4U’s hacking guide for intercepting aggregate data to decrypt aren’t valid anymore either, and haven’t been for some time.

MongoDB accepted the pushes from C1PH3R Group and others that patched a lot of those issues.

1 Like