1

I stored a js function in my mongoDb and want to send data to it and receive answer from python.

which module can help ?

i have many JavaScript function in Mongo and want call one of them from python and it call otherOnes,

Nozar Safari
  • 505
  • 4
  • 17

1 Answers1

0

You can execute the string as python code using built-in function exec(string)

a = 'Your Python Code from mongo as string'
exec(a)

Example:

a = '''def ast():
       array =[1,2,3,4]
       return a
'''
exec(a)
ast()

output:

[1,2,3,4]