Call MongoDB stored function from pymongo

Solution 1:

eval, system_js etc. are all deprecated.

While you can still create javascript functions on the server, it comes with a clear warning:

Do not store application logic in the database. There are performance limitations to running JavaScript inside of MongoDB. Application code also is typically most effective when it shares version control with the application itself.