The aggregation looks like:
res = Things.objects._collection.aggregate(pipeline,
allowDiskUse=True,
batchSize=101,
noCursorTimeout=True
)
and fails with
OperationFailure: unrecognized field 'noCursorTimeout'
It appears from the Pymongo documentation that no_cursor_timeout can be used with find(), however I have been unsuccessful locating a comparable **kwargs for aggregate().
I do not want to use setParameter or maxTimeMS.
UPDATE:
From MongoDB's Jira Site: SERVER-15042
The NoCursorTimeout bit in the OP_QUERY header prevents the server from closing a cursor that's idle for more than 10 minutes. Clients can set this bit if they may spend more than 10 minutes processing a batch of results.
The "aggregate" and "parallelCollectionScan" commands should allow the client to turn off cursor timeouts, too.
The response to this ticket was:
We intentionally do not support noCursorTimeout. The rationale for needing this will go away when we implement cursor keepalive. That work will be tracked in SERVER-6036.
Looking at SERVER-6036:
- Updated: Sep 14 2016 03:53:05 PM GMT+0000
- Status: OPEN
- Resolution: Unresolved
- Fix Version/s: planned but not scheduled
If I have read the documents correctly, a cursor no timeout option does not exist yet for aggregate().
You're correct, cursor timeout can't be disabled on individual aggregation cursors. But we've provided a global config setting,
cursorTimeoutMillis
, that you can increase to a large number:See SERVER-8188 for MongoDB version info, and how to set this parameter at runtime.