Mongodb aggregate. How to apply a function to a field

As part of an aggregate I need to run this transformation:

{ $eq: [ "$_id", sha256( { $toString: "$creatorId" } ) ] },

creatorId comes from a lookup, and in order to compare it to _id I first need to do a sha256.

How can I do it?


Ah I looked into same thing, few days ago;

There is a request ticket open, and waiting for a long time… it is at

@Eduardo_Cobian let me know if you find a workaround.

1 Like