Small fix documentation aggregation

Updated the example of Grouping
This commit is contained in:
Vladimir Savin 2015-04-19 15:56:18 +03:00 committed by behackett
parent 22cf7f2918
commit 12cefd69c0

View File

@ -174,14 +174,13 @@ reduce function.
Here we are doing a simple group and count of the occurrences of ``x`` values:
.. doctest::
>>> from bson.code import Code
>>> reducer = Code("""
... function(obj, prev){
... prev.count++;
... }
... """)
...
>>> from bson.son import SON
>>> results = db.things.group(key={"x":1}, condition={}, initial={"count": 0}, reduce=reducer)
>>> for doc in results:
... print doc