DataBrewery / cubes-mongo

[MAINTAINER WANTED] Cubes mongo backend
MIT License
7 stars 5 forks source link

command cursor object has no attribute get #3

Closed voldesh closed 8 years ago

voldesh commented 8 years ago

Traceback (most recent call last): File "agg2.py", line 18, in <module> result = browser.aggregate() File "/usr/local/lib/python2.7/dist-packages/cubes/browser.py", line 174, in aggregate **options) File "/usr/local/lib/python2.7/dist-packages/cubes/backends/mongo/browser.py", line 132, in provide_aggregate page_size=page_size) File "/usr/local/lib/python2.7/dist-packages/cubes/backends/mongo/browser.py", line 449, in _do_aggregation_query results = self.data_store.aggregate(pipeline).get('result', []) AttributeError: 'CommandCursor' object has no attribute 'get'

voldesh commented 8 years ago

I was using PyMongo 3.0+. The aggregate function returns a CommandCursor object which does not have a get function. Downgraded to 2.7 and the original code worked. Otherwise, you need to remove the .get('result', []) part on line 441 in browser.py