I can't find any documentation on this behavior, but a little testing reveals that your code is running just fine, but either stored functions can't use print
or the output of print
goes somewhere other than stdout. If you return
strings instead of printing them, you'll see what you would expect.
I suspect the output is going to the MongoDB logs, but I'm not sure where my install put them.