ok, I get the same output with 1. $where and $function 2. $expr and $function operator which are used for querying the collection.
I have another query. - how to add md5 hash value in mongodb collections?
In the above example hex_md5(name) == “15b0a220baa16331e8d80e15367677ad”
How do we get this 32 digits hexadecimal number?
I get your point. But , still you didn’t tell me the specification for incorporating hex_md5 method in MongoDB Shell.
How do you get hex_md5 = “15b0a220baa16331e8d80e15367677ad” ? Any hexadecimal 32 digits can not be used instead.
Your example code uses $function in the query predicate to test for equality with md5. If you want to return md5 then you need to use $function in the projection part of the query to create the new field. You can do this with aggregate command in 4.2 or if you are already on 4.4 you can just use aggregation expressions in find. Using the same sample data: