Details
-
Bug
-
Resolution: Cannot Reproduce
-
Major - P3
-
None
-
None
-
python, mongo, mac osx, linux
*Location*: https://docs.mongodb.org/getting-started/python/aggregation/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
*Referrer*: https://www.google.be/
*Screen Resolution*: 1920 x 1080
*repo*: docs
*source*: aggregation
python, mongo, mac osx, linux *Location*: https://docs.mongodb.org/getting-started/python/aggregation/ *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36 *Referrer*: https://www.google.be/ *Screen Resolution*: 1920 x 1080 *repo*: docs *source*: aggregation
Description
Hello, (https://docs.mongodb.org/getting-started/python/aggregation/)
Your documentation is not complete.
The "db.collection.aggregate.(....)" will not return a cursor on the different value but a dict with "ok" (with value 0 or 1) and "result" (with the different values).
The actual documentation should be:
----------------------------------------------------------------------------------------
cursor = db.restaurants.aggregate(
[
{"$group": {"_id": "$borough", "count":
}}
]
)
if cursor['ok'] == 1:
for document in cursor['result']:
print(document)
else:
print "No document found"
----------------------------------------------------------------------------------------
Hope it will be useful.
Thanks you.