You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't overwrite built-in names in map/reduce examples
Avoid assigning the MongoDB map/reduce function definitions to Python
variables that have the same name as the built-in Python functions map()
and reduce(), since that will effectively remove the possibility of
using those built-ins in surrounding code.
All of the optional map/reduce parameters are also supported, simply pass them as keyword arguments. In this example we use the `query` parameter to limit the documents that will be mapped over:
97
97
98
98
.. doctest::
99
99
100
-
>>> result = db.things.map_reduce(map, reduce, "myresults", query={"x": {"$lt": 3}})
100
+
>>> result = db.things.map_reduce(mapper, reducer, "myresults", query={"x": {"$lt": 3}})
101
101
>>> for doc in result.find():
102
102
... print doc
103
103
...
@@ -109,7 +109,7 @@ With MongoDB 1.8.0 or newer you can use :class:`~bson.son.SON` to specify a diff
0 commit comments