Open mikeiwi opened 8 years ago
@miketb24 A lot of the deep internals in txmongo (especially things that deal with IO, like cursors) are not directly compatible with pymongo. It is very difficult (if not impossible) to directly iterate over something in Twisted that depends on IO in the middle of a loop.
Perhaps the documentation should be more clear to point those differences out.
@miketb24 TxMongo doesn't have cursor support for aggregate for now. But patches are welcome :-)
Quick research on the topic showed that aggregate
command with cursor:{}
returns a document of different shape: it contains the cursor id (possibly 0) and the first batch of results.
The solution would be to extract cursor consuming logic from find_with_cursor
and use it in both find_with_cursor
and aggregate
.
According to pymongo you can pass a kwarg parameter
useCursor
in an aggregate call so the returned value will be a cursor instead of a document with the whole query result. This seems to be not working with txmongo, I'm getting aaggregate() got an unexpected keyword argument 'useCursor'
error.This is a sample of the code I'm running:
I also checked the aggregate method in collection.py but couldn't find anything related to a cursor, only **kwargs (just like in pymongo), but they seem to be not working.
Am I missing something here maybe?, Thank you so much for your help.