我正在使用pyMongo 1.11和MongoDB 1.8.2.我正在尝试做一个相当复杂的Map/Reduce.我在Mongo中对函数进行了原型设计并使其正常工作,但是当我尝试将其转换为Python时,我得到:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Developer/R-and-D/<ipython-input-71-3c3a43221538> in <module>()
----> 1 results = db.user_actions.mapReduce(map, reduce, "user_entities_interactions")
/Library/Python/2.7/site-packages/pymongo/collection.pyc in __call__(self, *args, **kwargs)
1099 "call the '%s' method on a 'Collection' object it is "
1100 "failing because no such method exists." %
-> 1101 self.__name.split(".")[-1])
TypeError: 'Collection' object is not callable. If you meant to call the 'mapReduce' method on a 'Collection' object it is failing because no such method exists.
Run Code Online (Sandbox Code Playgroud)
我的收藏看起来像这样:
{ "_id" : ObjectId("..."), "entity_id" …Run Code Online (Sandbox Code Playgroud)