The mongo shell includes a useful print command.
When executing map_reduce from pymongo, how can one print / log info from within a javascript block?
Update: OK, I have an answer. The process running mongo will output whatever is printed with print(). A second option is to configure mongo logging (and probably tailing the log files). Virtual bonus points for answering “Can I still get these values directly in python via pymongo?”
You can still use
print()inside the JS block which will get written to/var/log/mongodb/mongodb.log, more info here. Due to the fact thatmap/reducehappens server-side it won’t emit anything in your Python application.