I have a MapReduce job for my MongoDB database implemented in a Javascript script file. I've tested it from the commandline and Mongo shell (load("MR_stack.js")
). Now I'm using Pymongo within a larger application to access the Mongo database. How can I execute my MR_stack.js
script from within Pymongo?
相关问题
- how to define constructor for Python's new Nam
- MongoDB can not create unique sparse index (duplic
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
from bson import Binary, Code
You can use this library for running your javascript mapreduce code like this
Well, your favorite option is to read existing documentation:
http://api.mongodb.org/python/2.1/examples/map_reduce.html
The database object has an
eval
method:http://api.mongodb.org/python/current/api/pymongo/database.html